/* النافذة T — الدعم: صندوق التذاكر، أدوات الطاقم، البوت، التقييمات، استبيان التحديث.
   متغيّرات الثيم فقط (الثلاثة)، خصائص منطقية (RTL/LTR)، بلا تدرّجات. الهاتف ≤ 720px. */

/* ── صندوق التذاكر ── */
.hd-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hd-tabs { flex-wrap: wrap; }
.hd-count { display: inline-block; min-inline-size: 1.6em; margin-inline-start: 6px; padding: 0 6px; border-radius: 999px;
            background: var(--bg); border: 1px solid var(--border); font-size: .75rem; font-weight: 700; text-align: center; }
.hd-count.is-hot { background: #dc2626; border-color: #dc2626; color: #fff; }
/* التبويب النشط: العدّاد يرث لون التبويب (كان دائرة داكنة بلا رقم ظاهر على الخلفية الفاتحة) */
.hd-tabs a.active .hd-count:not(.is-hot) { background: transparent; border-color: currentColor; color: inherit; }
.hd-ai-posted { color: #16a34a; border-color: #16a34a; }
.hd-filters input[type=search] { min-inline-size: 0; flex: 1 1 240px; }
.hd-clear { align-self: center; font-size: .85rem; }
.hd-hint { margin-top: -6px; }

.hd-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.hd-row {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center;
    padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); text-decoration: none;
}
.hd-row:hover { border-color: var(--primary); }
.hd-row.is-unread { border-inline-start: 4px solid var(--primary); }
.hd-row.is-unread .hd-subj-t { font-weight: 700; }
.hd-row.is-urgent { border-inline-start: 4px solid #dc2626; }
.hd-row.is-high { border-inline-start: 4px solid #d97706; }
.hd-subj { display: flex; flex-direction: column; gap: 2px; min-inline-size: 0; overflow-wrap: anywhere; }
.hd-subj small { font-size: .8rem; }
.hd-pin { display: inline-block; inline-size: 9px; block-size: 9px; margin-inline-end: 6px; border-radius: 2px;
          background: var(--primary); transform: rotate(45deg); vertical-align: middle; }
.hd-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hd-pri, .hd-ai { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700;
                  border: 1px solid var(--border); white-space: nowrap; }
.hd-pri-high { color: #d97706; border-color: #d97706; }
.hd-pri-urgent { color: #fff; background: #dc2626; border-color: #dc2626; }
.hd-ai { color: var(--primary); border-color: var(--primary); }
.hd-date { font-size: .8rem; white-space: nowrap; }

/* ── صفحة التذكرة (الطاقم) ── */
.hd-tools { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.hd-meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; margin-bottom: 10px; }
.hd-pinf { display: flex; align-items: center; min-block-size: 42px; }
.hd-inline { display: inline; margin: 0; }
.hd-bot-warn { padding: 8px 10px; border-radius: 8px; border: 1px solid #d97706; color: var(--text); background: var(--bg); }
.hd-bot-sum { margin: 8px 0; line-height: 1.7; }
.hd-bot-sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.hd-bot-reply { padding: 10px 12px; margin: 8px 0; border-radius: 8px; border: 1px dashed var(--border); background: var(--bg);
                line-height: 1.7; overflow-wrap: anywhere; }
.hd-note-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hd-note { padding: 9px 12px; border-radius: 8px; border: 1px solid #d9a400; background: var(--bg); overflow-wrap: anywhere; line-height: 1.6; }
.hd-note header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .85rem; margin-bottom: 4px; }
.hd-link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }
.hd-link-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.hd-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--border); }
.hd-tag-bot { color: var(--primary); border-color: var(--primary); }
.hd-tag-del { color: #dc2626; border-color: #dc2626; }
.hd-is-deleted .mxp-bubble { opacity: .55; }
.hd-is-deleted .mxp-msg-body { text-decoration: line-through; }
.hd-msg-del { margin-inline-start: auto; }
.hd-draft-note { display: block; margin-top: 4px; font-size: .78rem; }

/* ── توزيع النجوم ── */
.hd-dist-avg { font-size: 1.15rem; margin: 0 0 10px; }
.hd-dist-avg span[aria-hidden] { color: #e8a317; }
.hd-dist-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hd-dist-bars li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) 6.5em; gap: 10px; align-items: center; }
.hd-dist-bar { display: block; block-size: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.hd-dist-bar > span { display: block; block-size: 100%; background: #e8a317; }
.hd-dist-n { white-space: nowrap; }
.hd-stars { color: #e8a317; letter-spacing: 1px; white-space: nowrap; }

/* ── إعدادات الدعم ── */
.hd-subtabs { margin-top: -4px; }
.hd-secret input { max-inline-size: 32rem; }
.hd-missing { margin: 6px 0 0; padding-inline-start: 20px; }
.hd-modes { border: 0; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hd-mode { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.hd-mode span { display: flex; flex-direction: column; gap: 2px; }
.hd-mode:has(input:checked) { border-color: var(--primary); }
.hd-clip { max-inline-size: 42ch; overflow-wrap: anywhere; }
.hd-depts-f { display: flex; flex-wrap: wrap; gap: 4px 12px; }

/* ── مراقبة الخدمات + معرفة البوت + أفعال الموظّف (11-29) ── */
.hd-mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 8px 14px; margin: 8px 0; }
.hd-mon-grid input { max-inline-size: 9rem; }
.hd-kn-list { margin: 0 0 10px; padding-inline-start: 20px; color: var(--text-dim); }
.hd-kn-list li { margin: 2px 0; }
#hd-knowledge textarea { inline-size: 100%; box-sizing: border-box; font: inherit; resize: vertical; }
.hd-alert { border-inline-start: 4px solid #d97706; }
.hd-alert-high { border-inline-start-color: #dc2626; }
.hd-alert-h { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.hd-alert-h .mono { margin-inline-start: auto; }
.hd-alert-svc, .hd-alert-facts { margin: 4px 0; overflow-wrap: anywhere; }
.hd-alert-advice { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.hd-pre { white-space: pre-line; overflow-wrap: anywhere; margin-top: 4px; }
.hd-alert-f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.adm-badge.hd-sev-high { background: rgba(220,38,38,.14); border-color: rgba(220,38,38,.45); color: #dc2626; }
.adm-badge.hd-sev-warn { background: rgba(217,119,6,.14); border-color: rgba(217,119,6,.45); color: #b45309; }
.hd-staff-actions td { overflow-wrap: anywhere; }

/* ── §3: «تذكرة جديدة» — خطوتان (11-29، 11-30) ── */
.hd-tf fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.hd-tf legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
/* الخطوة 1: «كيف يمكننا مساعدتك؟» — بطاقة كبيرة لكل موضوع */
.hd-tf-pick-h h2 { margin: 0 0 4px; font-size: 1.25rem; font-weight: 800; }
.hd-tf-pick-h p { margin: 0; }
.hd-tf-depts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.hd-tf-dept { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 16px; border: 2px solid var(--border); border-radius: 14px;
              background: var(--bg); color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s; }
.hd-tf-dept:hover { border-color: color-mix(in srgb, var(--c) 55%, transparent); transform: translateY(-2px);
                    box-shadow: 0 10px 24px color-mix(in srgb, var(--c) 18%, transparent); color: var(--text); }
.hd-tf-dept:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.hd-tf-dico { width: 52px; height: 52px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff;
              box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 35%, transparent); }
.hd-tf-dico .mx-i { width: 24px; height: 24px; }
.hd-tf-dtx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hd-tf-dtx b { font-size: 1rem; font-weight: 800; color: var(--text); }
.hd-tf-dtx small { color: var(--text-dim); font-size: .8rem; line-height: 1.45; }
.hd-tf-darr { flex: none; color: var(--text-dim); transition: color .2s; }
.hd-tf-dept:hover .hd-tf-darr { color: var(--c); }
/* الخطوة 2: شريط «الموضوع المختار» + «تغيير» */
.hd-tf-sel { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: 14px;
             border: 1px solid color-mix(in srgb, var(--c) 35%, var(--border)); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.hd-tf-sel .hd-tf-dico { width: 44px; height: 44px; border-radius: 12px; }
.hd-tf-sel .hd-tf-dico .mx-i { width: 20px; height: 20px; }
.hd-tf-sel .hd-tf-dtx small { font-size: .72rem; font-weight: 700; }
.hd-tf-change { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 7px 12px; border-radius: 10px; font-size: .82rem; font-weight: 700;
                color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
                border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.hd-tf-change .mx-i { width: 14px; height: 14px; }
/* .hd-tf قبلها: «.hd-tf fieldset» يصفّر الحدود والهوامش وإلا غلب */
.hd-tf .hd-tf-order { margin-bottom: 16px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; }
.hd-tf .hd-tf-order legend { padding: 0 6px; }
.hd-tf-none { margin: 22px 0 0; font-size: .88rem; }
.hd-tf .hd-tf-kinds { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hd-tf-kinds legend { inline-size: 100%; }
.hd-tf-kind { position: relative; cursor: pointer; }
.hd-tf-kind input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hd-tf-kind span { display: inline-block; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.hd-tf-kind:has(input:checked) span { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.hd-tf-kind input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.hd-kind { display: inline-block; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); font-size: .78rem; white-space: nowrap; }
.hd-kind-refill { border-color: rgba(217,119,6,.5); color: #b45309; }
.hd-kind-cancel { border-color: rgba(220,38,38,.45); color: #dc2626; }
.hd-kind-speedup { border-color: rgba(37,99,235,.45); color: #2563eb; }
.hd-kind-line { margin: 0 0 8px; }
@media (max-width: 600px) {
    .hd-tf-depts { grid-template-columns: 1fr; }
    .hd-tf-dept { padding: 14px; }
}
/* قائمة التذاكر (11-30): شريط بلون الحالة على حافّة السطر + عدد الرسائل — نفس ألوان .mxp-tks-* */
.mxp-tk-list .mxp-tk-row { position: relative; }
.mxp-tk-list .mxp-tk-row::before { content: ''; position: absolute; inset-block: 12px; inset-inline-start: 0; width: 4px; border-radius: 4px;
                                   background: var(--hd-st, transparent); }
.mxp-tk-list .mxp-tk-row:has(.mxp-tks-open) { --hd-st: #0284c7; }
.mxp-tk-list .mxp-tk-row:has(.mxp-tks-answered) { --hd-st: var(--ok); }
.mxp-tk-list .mxp-tk-row:has(.mxp-tks-customer_reply) { --hd-st: #d97706; }
.mxp-tk-list .mxp-tk-row:has(.mxp-tks-closed) { --hd-st: #6b7280; }
.hd-tk-n { display: inline-flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: .78rem; font-weight: 700; }
.hd-tk-n .mx-i { width: 14px; height: 14px; }
/* المحادثة (11-30): صورة المرفق مصغّرة، والنقر يفتح الحجم الكامل */
.mxp-atts .hd-att-img a { padding: 0; border-radius: 10px; overflow: hidden; }
.hd-att-img img { display: block; width: 120px; height: 90px; object-fit: cover; }

/* ── استبيان «قيّم آخر تحديث» ── */
.hd-sv { position: fixed; inset-inline-end: 16px; inset-block-end: 16px; z-index: 900; inline-size: min(380px, calc(100vw - 24px)); }
.hd-sv[hidden] { display: none; }
.hd-sv-card { position: relative; padding: 16px 16px 12px; border-radius: var(--radius); border: 1px solid var(--border);
              background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.hd-sv-card h2 { margin: 0 0 4px; font-size: 1.02rem; padding-inline-end: 28px; }
.hd-sv-what { margin: 0 0 8px; color: var(--text-dim); font-size: .9rem; overflow-wrap: anywhere; }
.hd-sv-x { position: absolute; inset-inline-end: 8px; inset-block-start: 6px; inline-size: 32px; block-size: 32px; border: 0;
           background: none; color: var(--text-dim); font-size: 1.3rem; line-height: 1; cursor: pointer; border-radius: 8px; }
.hd-sv-x:focus-visible { outline: 2px solid var(--primary); }
/* الترتيب في الصفحة 5→1 مع row-reverse: النجمة 1 في جهة البداية بالاتجاهين، وflex-end يلصقها بالبداية */
.hd-sv-stars { border: 0; margin: 0 0 8px; padding: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.hd-sv-stars legend { font-size: .88rem; margin-bottom: 4px; }
.hd-sv-stars label { position: relative; cursor: pointer; font-size: 1.9rem; line-height: 1; color: var(--border); }
.hd-sv-stars input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hd-sv-stars label:hover, .hd-sv-stars label:hover ~ label,
.hd-sv-stars label:has(input:checked), .hd-sv-stars label:has(input:checked) ~ label { color: #e8a317; }
.hd-sv-stars label:has(input:focus-visible) { outline: 2px solid var(--primary); border-radius: 6px; }
.hd-sv-sugg { display: block; font-size: .85rem; color: var(--text-dim); }
.hd-sv-sugg textarea { display: block; inline-size: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px 10px; border-radius: 8px;
                       border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
.hd-sv-act { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.hd-sv-msg { margin: 6px 0 0; font-size: .85rem; min-block-size: 1em; }

@media (max-width: 720px) {
    .hd-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    .hd-num, .hd-date { display: none; }
    .hd-badges { grid-column: 1 / -1; justify-content: flex-start; order: 3; }
    .hd-meta-grid { grid-template-columns: 1fr 1fr; }
    .hd-modes { grid-template-columns: 1fr; }
    .hd-dist-bars li { grid-template-columns: 3em minmax(0, 1fr) 5.5em; }
    .hd-sv { inset-inline: 12px; inset-block-end: 76px; inline-size: auto; }   /* فوق الشريط السفلي للهاتف */
}
