/* =========================================================
   لوحة دكتور هوم · التخطيط الجديد (2026-11-08)
   شريط جانبي عالكمبيوتر + شريط أقسام أفقي عالموبايل، جرس إشعارات موحّد،
   طلبات بفلاتر وأقسام وكروت مطوية، فريق مرتّب، ومحاسبة واضحة.
   ========================================================= */
#app { max-width: none; width: 100%; box-shadow: none; background: var(--page); }
@media (min-width: 1000px) { #app { padding-inline-start: 0; max-width: none; } .crm-main .content { max-width: 1120px; padding: 22px 28px; } }
#scr-login { background: var(--bg); }
#scr-panel { padding-bottom: 0 !important; min-height: 100dvh; }
.crm-shell { display: flex; min-height: 100dvh; align-items: stretch; }
.crm-main { flex: 1; min-width: 0; background: var(--page); }

/* ===== الشريط الجانبي ===== */
.crm-side {
  width: 236px; flex: none; background: var(--card); border-inline-end: 1px solid var(--line);
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; z-index: 30;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: var(--brand-text); }
.side-brand img { width: 40px; height: 40px; border-radius: 12px; }
.side-brand b { display: block; font-size: 1rem; line-height: 1.2; }
.side-brand span { font-size: .74rem; color: var(--muted); }
.side-x { display: none; margin-inline-start: auto; border: 0; background: var(--card-2); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; color: var(--text); }
.side-user { display: flex; align-items: center; gap: 10px; margin: 0 12px 8px; padding: 10px 12px; border-radius: 14px; background: var(--brand-soft); }
.su-av { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.side-user h1 { font-size: .95rem; line-height: 1.3; margin: 0; }
.side-user .role-line { font-size: .76rem; color: var(--muted); margin: 0; }
.crm-nav { padding: 4px 10px 10px; flex: 1; }
.nav-grp-l { font-size: .7rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; margin: 12px 8px 4px; }
.crm-tab {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text-2);
  padding: 10px 10px; border-radius: 12px; font-family: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; text-align: start;
  position: relative;
}
.crm-tab .ms { font-size: 1.35rem; color: var(--muted); }
.crm-tab:hover { background: var(--card-2); }
.crm-tab.on { background: var(--brand-soft); color: var(--brand-text); }
.crm-tab.on .ms { color: var(--brand-text); font-variation-settings: "FILL" 1, "wght" 400; }
.crm-tab .count-pill { margin-inline-start: auto; }
.crm-tab[data-tab="ambulance"] .ms { color: #c03434; }
.side-foot { padding: 8px 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.menu-row {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text-2);
  padding: 9px 10px; border-radius: 10px; font-family: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; text-align: start;
}
.menu-row .ms { font-size: 1.25rem; color: var(--muted); }
.menu-row:hover { background: var(--card-2); }
.menu-row.danger { color: var(--danger); }
.menu-row.loc-btn.sharing { background: var(--ok-bg) !important; color: var(--ok) !important; border: 0 !important; }
.menu-row.loc-btn.sharing .ms { color: var(--ok); }
.crm-backdrop { display: none; position: fixed; inset: 0; background: rgba(8, 30, 38, .5); z-index: 29; }

/* ===== الشريط العلوي ===== */
.crm-top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
}
.top-menu { display: none; }
.top-title { font-size: 1.05rem; margin: 0; white-space: nowrap; }
.crm-top .crm-search { flex: 1; margin: 0 6px; min-width: 0; }
.crm-top .crm-search input { padding: 9px 0; font-size: .9rem; }
.crm-search.mob { display: none; }
.crm-top .icon-btn { width: 40px; height: 40px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); color: var(--text-2); flex: none; }
.top-bell { position: relative; }
.top-bell .count-pill { position: absolute; top: -6px; inset-inline-end: -6px; margin: 0; min-width: 20px; text-align: center; }
.top-bell.hot .ms { color: var(--danger); font-variation-settings: "FILL" 1, "wght" 400; animation: bellShake 2.4s ease-in-out infinite; }
@keyframes bellShake { 0%, 80%, 100% { transform: none; } 84% { transform: rotate(14deg); } 88% { transform: rotate(-12deg); } 92% { transform: rotate(8deg); } 96% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .top-bell.hot .ms { animation: none; } }
.top-sp { flex: 1; }

/* قائمة ⋮ */
.crm-menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 12px; width: 250px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--sh-2); padding: 8px; z-index: 40; display: grid; gap: 2px; }

/* ===== مركز الإشعارات ===== */
.notif-panel { position: fixed; top: calc(62px + env(safe-area-inset-top)); inset-inline-end: 16px; width: min(420px, calc(100vw - 32px)); max-height: min(70vh, 620px);
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-2); z-index: 45; display: flex; flex-direction: column; overflow: hidden; }
.np-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 800; }
.np-head .count-pill { margin: 0; }
.np-head .np-x { margin-inline-start: auto; border: 0; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.np-list { overflow-y: auto; padding: 6px; }
.np-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: transparent; padding: 10px; border-radius: 12px; font-family: inherit; text-align: start; cursor: pointer; color: var(--text); }
.np-item:hover { background: var(--card-2); }
.np-item .np-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.np-item.hot .np-ic { background: var(--danger-bg); color: var(--danger); }
.np-item.warn .np-ic { background: var(--warn-bg); color: var(--warn); }
.np-item.ok .np-ic { background: var(--ok-bg); color: var(--ok); }
.np-item b { display: block; font-size: .9rem; line-height: 1.4; }
.np-item span { display: block; font-size: .78rem; color: var(--muted); line-height: 1.5; }
.np-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: .9rem; }
.np-empty .ms { display: block; font-size: 2.2rem; color: var(--ok); margin-bottom: 6px; }

/* ===== شريط الأقسام عالموبايل ===== */
.crm-tabs { display: none; }

/* ===== الطلبات ===== */
.ord-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ord-stat { border: 1.5px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 12px; text-align: start; font-family: inherit; cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.ord-stat b { font-size: 1.4rem; font-weight: 800; line-height: 1.1; }
.ord-stat span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.ord-stat.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent); }
.ord-stat.new b { color: #8a6300; } .ord-stat.act b { color: var(--brand-text); } .ord-stat.late b { color: var(--danger); } .ord-stat.dec b { color: #b54708; } .ord-stat.done b { color: var(--ok); }
.ord-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.ord-filters select { font: inherit; font-size: .84rem; font-weight: 600; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); max-width: 190px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: .82rem; font-weight: 700; padding: 6px 11px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.seg button b { font-weight: 800; margin-inline-start: 3px; opacity: .8; }
.ord-sec { margin-bottom: 18px; }
.ord-sec-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-size: 1rem; }
.ord-sec-h .ms { color: var(--brand-text); font-size: 1.3rem; }
.ord-sec-h .n { font-size: .78rem; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; color: var(--muted); }
.ord-sec-h.dec .ms { color: #b54708; }
.ord-sec.dec .o-card { border-color: #f0b27a; background: #fffaf3; }
.ord-dec-note { font-size: .84rem; color: #9a4f00; background: #fff4e5; border-radius: 12px; padding: 9px 12px; margin-bottom: 10px; line-height: 1.7; }
details.ord-arch > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; font-weight: 800; font-size: 1rem; }
details.ord-arch > summary::-webkit-details-marker { display: none; }
details.ord-arch > summary .ms { color: var(--muted); transition: transform .2s; }
details.ord-arch[open] > summary .ms.chev { transform: rotate(180deg); }
.ord-more { width: 100%; margin: 4px 0 10px; }
.ord-empty { padding: 30px 16px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: 16px; }

/* الكرت المطوي */
.ocard { padding: 0; overflow: hidden; }
.oc-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none; }
.oc-head:hover { background: var(--card-2); }
.oc-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.oc-ic .ms { font-size: 1.35rem; }
.ocard.is-new .oc-ic { background: #fff4d6; color: #8a6300; }
.ocard.is-late .oc-ic { background: var(--danger-bg); color: var(--danger); }
.oc-main { flex: 1; min-width: 0; }
.oc-l1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .95rem; }
.oc-l2 { font-size: .82rem; color: var(--muted); margin-top: 2px; line-height: 1.6; }
.oc-l2 .oc-who { color: var(--text-2); font-weight: 600; }
.oc-l2 .oc-who .ms { font-size: 1rem; vertical-align: -3px; }
.oc-l2 .oc-who.none { color: #b54708; }
/* متابعة الطلب للآخر */
.fu-box { border: 1px dashed var(--line-strong, #c8d3d6); border-radius: 12px; padding: 8px 12px; margin: 6px 0 8px; font-size: .88rem; }
.fu-box.done { border-color: #12b76a; background: #f6fef9; }
.fu-step { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.fu-step .grow { flex: 1; min-width: 0; }
.fu-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; border: 1.5px solid var(--line-strong, #c8d3d6); flex: none; }
.fu-step.ok .fu-n { background: #12b76a; border-color: #12b76a; color: #fff; }
.fu-issue { margin-top: 2px; color: #b54708; }
/* واتساب الشركة */
.wa-wrap { display: grid; gap: 14px; max-width: 900px; }
.wa-card { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.wa-card.done { border-color: #abefc6; }
.wa-card h3 { margin: 0 0 10px; font-size: 1rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wa-card h3 .ms { color: #25a35a; }
.wa-ok { font-size: .78rem; font-weight: 600; color: #05603a; background: #ecfdf3; border-radius: 999px; padding: 2px 10px; }
.wa-steps { margin: 0 0 10px; padding-inline-start: 20px; line-height: 1.9; font-size: .9rem; }
.wa-l { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.wa-l input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.wa-log { display: flex; flex-direction: column; }
.wa-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.wa-row:first-child { border-top: 0; }
.wa-row .grow { flex: 1; min-width: 0; }
.wa-row p { margin: 4px 0 0; font-size: .86rem; white-space: pre-wrap; color: var(--text-2); }
/* شات الفريق: باسم دكتور هوم + ردود محفوظة */
.tc-by { display: block; font-size: .72rem; opacity: .75; margin-top: 4px; }
/* رسائل الإدارة: ذهبي + شعار */
.msg-bubble.tc-brandmsg.them { background: linear-gradient(135deg, #fff8e6, #fdecc8); border: 1.5px solid #e0a82e; color: #3d2c06; }
.msg-bubble.tc-brandmsg.me { background: linear-gradient(135deg, #0a4d63, #0d6b5e); box-shadow: inset 0 0 0 2px #e0a82e; }
.tc-brandhead { display: flex !important; align-items: center; gap: 6px; white-space: nowrap; color: #8a5a00 !important; font-weight: 800; }
.msg-bubble.tc-brandmsg.me .tc-brandhead { color: #ffd77a !important; }
.tc-brandhead img { width: 18px; height: 18px; border-radius: 5px; }
.tc-brandhead span { color: inherit !important; opacity: .8; font-weight: 600; }
.tc-saved-btn { border: 1px solid var(--line); background: var(--card, #fff); border-radius: 50%; width: 40px; height: 40px; flex: none; font-size: 1.05rem; cursor: pointer; }
.tc-saved-btn[hidden] { display: none; }
.tc-saved { position: fixed; z-index: 3000; max-height: 60vh; overflow: auto; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 10px; }
.tc-saved[hidden] { display: none; }
.tcs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.tcs-row { display: flex; gap: 6px; align-items: stretch; margin-top: 6px; }
.tcs-use { flex: 1; min-width: 0; text-align: start; border: 1px solid var(--line); background: var(--card-2, #f4f7f9); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: .86rem; cursor: pointer; white-space: pre-wrap; }
.tcs-use small { display: block; color: var(--muted); font-size: .72rem; margin-top: 3px; }
.tcs-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }
/* شات الفريق: رد + تفاعلات */
.tc-row { display: flex; align-items: flex-end; gap: 4px; max-width: 88%; }
.tc-row.me { align-self: flex-start; }
.tc-row.them { align-self: flex-end; flex-direction: row-reverse; }
.tc-row .msg-bubble { align-self: auto; max-width: 100%; min-width: 0; }
.tc-row .tc-msg { position: relative; }
.tc-acts { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .15s; margin-bottom: 6px; }
.tc-row:hover .tc-acts, .tc-row:focus-within .tc-acts { opacity: 1; }
@media (hover: none) { .tc-acts { opacity: .55; } }
.tc-acts button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card, #fff); font: inherit; font-size: .95rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0; }
.tc-quote { display: block; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--brand-text); background: rgba(0,0,0,.05); border-radius: 8px; padding: 4px 8px; margin: 2px 0 6px; font: inherit; font-size: .8rem; color: inherit; cursor: pointer; max-height: 3.4em; overflow: hidden; }
.tc-quote b { display: block; font-size: .75rem; color: var(--brand-text); }
.tc-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tc-rc { border: 1px solid var(--line); background: var(--card, #fff); border-radius: 999px; padding: 1px 7px; font: inherit; font-size: .9rem; cursor: pointer; line-height: 1.5; }
.tc-rc.mine { border-color: var(--brand-text); background: color-mix(in srgb, var(--brand-text) 12%, #fff); }
.tc-rc small { font-size: .72rem; margin-inline-start: 3px; color: var(--muted); }
.tc-pick { position: fixed; z-index: 3000; display: flex; gap: 2px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.tc-pick[hidden] { display: none; }
.tc-pick button { border: 0; background: none; font-size: 1.35rem; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; padding: 0; }
.tc-pick button:hover { background: rgba(0,0,0,.06); }
.tc-replybar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--card-2, #f4f7f9); font-size: .82rem; }
.tc-replybar[hidden] { display: none; }
.tc-replybar .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.tc-replybar .grow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.tc-replybar button { border: 0; background: none; font-size: 1rem; cursor: pointer; color: var(--muted); }
.tc-flash .tc-msg { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-text) 35%, transparent); }
/* استوديو صور الكادر */
#ps-wrap { position: fixed; inset: 0; z-index: 2000; background: rgba(10,25,32,.55); display: flex; justify-content: center; padding: 12px; }
#ps-wrap[hidden] { display: none; }
.ps-box { background: var(--card, #fff); border-radius: 18px; width: min(1240px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.ps-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ps-head h2 { margin: 0; font-size: 1.12rem; } .ps-head p { margin: 3px 0 0; color: var(--muted); font-size: .84rem; } .ps-head .sp-close { margin-inline-start: auto; flex: none; }
.ps-bar { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.ps-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ps-prog { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; } .ps-prog i { display: block; height: 100%; background: var(--brand-text); transition: width .3s; }
.ps-grid { flex: 1; overflow: auto; padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; align-content: start; grid-auto-rows: max-content; }   /* بلاها: مع صور كتير الصفوف بتنضغط لخطوط (الكرت overflow:hidden) */
.ps-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; background: var(--card, #fff); }
.ps-card.is-ready { border-color: #12b76a; box-shadow: 0 0 0 2px rgba(18,183,106,.18); }
.ps-ph { position: relative; aspect-ratio: 1; background: #eef2f4; display: grid; place-items: center; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ps-ph img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-touch-callout: none; }
.ps-ph .ps-before { position: absolute; bottom: 6px; inset-inline-start: 6px; width: 30%; height: auto; aspect-ratio: 1; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.ps-load { color: var(--muted); }
.ps-info { padding: 8px 10px 2px; display: flex; flex-direction: column; gap: 2px; font-size: .88rem; }
.ps-st { font-size: .78rem; color: var(--muted); } .ps-st.ok { color: #05603a; } .ps-st.bad { color: #b42318; }
.ps-warn { font-size: .78rem; color: #b54708; margin: 0; }
.ps-acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; margin-top: auto; }
#ps-ed { position: fixed; inset: 0; z-index: 2001; background: rgba(10,25,32,.6); display: flex; align-items: center; justify-content: center; padding: 12px; }
.ps-ed-box { background: var(--card, #fff); border-radius: 18px; width: min(1000px, 100%); max-height: 100%; overflow: auto; }
.ps-ed-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); } .ps-ed-head .sp-close { margin-inline-start: auto; }
.ps-ed-main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; padding: 16px; }
@media (max-width: 760px) { .ps-ed-main { grid-template-columns: 1fr; } }
.ps-ed-ph { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #eef2f4; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.ps-ed-ph img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-touch-callout: none; }
.ps-ed-tip { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); white-space: nowrap; background: rgba(0,0,0,.5); color: #fff; font-size: .75rem; padding: 3px 10px; border-radius: 999px; }
.ps-ed-busy { position: absolute; top: 8px; inset-inline-end: 8px; background: #fff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.ps-ed-ctrl { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 640px) { #ps-wrap { padding: 0; } .ps-box { border-radius: 0; overflow: auto; } .ps-grid { flex: none; overflow: visible; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; } .ps-head p { display: none; } .ps-bar { padding: 8px 10px; } }
.ps-sl { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; font-size: .86rem; } .ps-sl input { width: 100%; accent-color: var(--brand-text); }
.crm-alert.ok { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.hold-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.nr-box > .grow { flex: 1; min-width: 0; }
.nr-row > .grow { flex: 1 1 180px; min-width: 0; }
.nr-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 0; border-top: 1px dashed var(--line); }
.nr-row:first-of-type { border-top: 0; }
.idc-fix { margin-top: 10px; font-size: .85rem; color: var(--muted); text-align: center; }
.cust-blk { display: block; margin-top: 4px; color: #b42318; font-size: .85rem; font-weight: 600; }
.cust-blk .ms { font-size: 1rem; vertical-align: -3px; margin-inline-end: 3px; }
.cust-note { display: block; font-size: .8rem; color: var(--text-2); margin-top: 2px; }
.cust-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.cust-rate .cr-s { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: #cbd5e1; cursor: pointer; padding: 0 1px; min-width: 32px; min-height: 36px; }
.cust-rate .cr-s.on { color: #f59e0b; }
.cust-rate .cr-note { flex: 1 1 200px; min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .85rem; }
.cust-rate .cr-hint { flex-basis: 100%; }
.oc-l3 { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: .8rem; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.oc-l3 > span { display: block; }
.oc-l3 b { color: var(--text-2); font-weight: 600; }
.oc-l3 .ms { font-size: 1rem; color: var(--brand-text); vertical-align: -3px; margin-inline-end: 4px; }
.oc-side { text-align: end; flex: none; display: flex; flex-direction: column; gap: 2px; }
.oc-total { font-size: .92rem; color: var(--brand-text); white-space: nowrap; }
.oc-chev { color: var(--muted); transition: transform .2s; flex: none; }
.ocard.open .oc-chev { transform: rotate(180deg); }
.oc-body { display: none; padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.ocard.open .oc-body { display: block; }
.st-chip { font-size: .72rem; font-weight: 800; padding: 2px 9px; border-radius: 999px; color: #fff; }
.st-chip.st-new { background: #8a6300; } .st-chip.st-confirmed { background: var(--brand); } .st-chip.st-onway { background: #7c4dbe; } .st-chip.st-done { background: var(--ok); } .st-chip.st-cancelled { background: var(--danger); }
.ocard.flash { animation: ocFlash 1.6s ease; }
@keyframes ocFlash { 0% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: var(--sh-1); } }
@media (max-width: 560px) { .oc-side { display: none; } .oc-l1 { font-size: .9rem; } }

/* ===== الفريق ===== */
.team-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.team-tools .chips { margin: 0; }
.team-sort { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
.team-sort select { font: inherit; font-size: .84rem; font-weight: 600; padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); }
.team-sub { margin: 16px 0 8px; font-size: .9rem; display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.team-sub .n { font-size: .76rem; background: var(--card-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); font-weight: 700; }
.tm-card { align-items: center; }
.tm-av { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); font-weight: 800; flex: none; position: relative; }
.tm-av .ms { font-size: 1.4rem; }
.tm-av i { position: absolute; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--card); bottom: -2px; inset-inline-end: -2px; background: #d92d20; }
.tm-av i.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.tm-av i { background: #c3ced2; }
.dot.live { background: #16a34a; box-shadow: 0 0 0 2px rgba(22,163,74,.25); }
.tm-meta .tm-on { color: #15803d; font-weight: 700; }
.tm-card.off .tm-av { background: var(--card-2); color: var(--muted); }
.tm-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.tm-meta .ms { font-size: .95rem; vertical-align: -2px; }
.tm-acts { display: flex; gap: 6px; align-items: center; flex: none; }
.tm-role { display: inline-block; white-space: nowrap; font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--text-2); }
.tm-card .rt { font-size: .8rem; }
mark.q { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 560px) { .tm-acts { width: 100%; justify-content: flex-end; } }

/* ===== المحاسبة ===== */
.acct-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.acct-month { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; padding: 3px; }
.acct-month button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 9px; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.acct-month button:hover { background: var(--card-2); }
.acct-month b { min-width: 150px; text-align: center; font-size: .95rem; }
.acct-month input { border: 0; background: transparent; font: inherit; width: 24px; opacity: 0; position: absolute; }
.acct-month label { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; cursor: pointer; color: var(--text-2); }
.acct-month label:hover { background: var(--card-2); }
.acct-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.acct-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ah { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.ah .l { font-size: .8rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ah .l .ms { font-size: 1.1rem; }
.ah .v { font-size: 1.3rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.ah .s { font-size: .74rem; color: var(--muted); line-height: 1.5; }
.ah.brand { background: linear-gradient(150deg, var(--brand), var(--brand-2)); color: #fff; border: 0; }
.ah.brand .l, .ah.brand .s, .ah.brand .v { color: #fff; }
.ah.brand .l { opacity: .85; } .ah.brand .s { opacity: .8; }
.ah.neg .v { color: var(--danger); }
.ah.ok .v { color: var(--ok); }
.acct-two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 760px) { .acct-two { grid-template-columns: 1fr; } }
.acct-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.acct-card h3 { margin: 0 0 10px; font-size: .95rem; display: flex; align-items: center; gap: 6px; }
.acct-card h3 .ms { color: var(--brand-text); font-size: 1.2rem; }
.wf { display: grid; gap: 6px; }
.wf-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .86rem; }
.wf-row .wl { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.wf-row .wl .sg { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: var(--card-2); color: var(--muted); flex: none; }
.wf-row.minus .wl .sg { background: var(--danger-bg); color: var(--danger); }
.wf-row.sum .wl .sg { background: var(--brand-soft); color: var(--brand-text); }
.wf-row .wv { font-weight: 800; white-space: nowrap; text-align: end; }
.wf-row.sum .wv { color: var(--brand-text); }
.wf-row.sum.final .wv { font-size: 1rem; }
.wf-row .wb { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.wf-row .wb i { display: block; height: 100%; background: var(--line-strong); border-radius: 999px; }
.wf-row.sum .wb i { background: var(--brand-3); }
.wf-row.minus .wb i { background: #f0a4a4; }
.wf-row.neg .wv { color: var(--danger); }
.wf-row.sum { padding-top: 4px; border-top: 1px dashed var(--line); margin-top: 2px; }
.acct-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acct-mini div { background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.acct-mini span { display: block; font-size: .74rem; color: var(--muted); }
.acct-mini b { font-size: 1.05rem; }
.acct-mini b.neg { color: var(--danger); } .acct-mini b.pos { color: var(--ok); }
.acct-people-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.acct-t { width: 100%; border-collapse: collapse; font-size: .85rem; background: var(--card); }
.acct-tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.acct-t th, .acct-t td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
.acct-t th { position: sticky; top: 0; background: var(--card-2); font-size: .74rem; color: var(--muted); font-weight: 700; cursor: pointer; user-select: none; }
.acct-t th.on { color: var(--brand-text); }
.acct-t th .ms { font-size: .9rem; vertical-align: -2px; }
.acct-t td.num { font-variant-numeric: tabular-nums; }
.acct-t td.dim { color: var(--line-strong); }
.acct-t tr.grp td { background: var(--card-2); font-weight: 800; font-size: .8rem; color: var(--text-2); border-top: 1px solid var(--line); }
.acct-t tr.tot td { background: var(--brand-soft); font-weight: 800; border-top: 2px solid var(--line-strong); }
.acct-t .neg { color: var(--danger); font-weight: 800; }
.acct-t .pos { color: var(--ok); font-weight: 800; }
.acct-t .who b { display: block; }
.acct-t .who span { font-size: .74rem; color: var(--muted); }
.acct-t .ok-mark { color: var(--ok); font-weight: 800; }
.acct-t tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 50%, transparent); }
.acct-t tr.tot:hover td { background: var(--brand-soft); }
.acct-post { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.acct-post p { flex: 1; min-width: 220px; margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.7; }
.acct-post .btn { width: auto; margin: 0; padding: 10px 16px; min-height: 0; }

/* ===== الموبايل والشاشات الضيقة ===== */
@media (max-width: 999px) {
  .crm-side { position: fixed; inset-inline-start: 0; top: 0; height: 100dvh; width: min(300px, 86vw); transform: translateX(100%); transition: transform .22s ease; box-shadow: none; }
  [dir="ltr"] .crm-side { transform: translateX(-100%); }
  .crm-side.open { transform: none; box-shadow: var(--sh-2); }
  .crm-backdrop.open { display: block; }
  .side-x { display: grid; place-items: center; }
  .top-menu { display: grid; place-items: center; }
  .top-title { font-size: 1rem; flex: 1; }
  .crm-top .crm-search { display: none; }
  .crm-search.mob { display: flex; margin: 10px 16px 0; }
  .crm-tabs { display: flex; gap: 6px; padding: 10px 16px 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .crm-tabs::-webkit-scrollbar { display: none; }
  .crm-tabs .crm-tab { width: auto; flex: none; border: 1.5px solid var(--line); background: var(--card); padding: 8px 12px; border-radius: 999px; font-size: .84rem; gap: 6px; }
  .crm-tabs .crm-tab .ms { font-size: 1.15rem; }
  .crm-tabs .crm-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
  .crm-tabs .crm-tab.on .ms { color: #fff; }
  .crm-tabs .crm-tab .count-pill { margin-inline-start: 2px; }
  .notif-panel { top: auto; bottom: 0; inset-inline: 0; width: 100%; max-height: 78vh; border-radius: 20px 20px 0 0; }
  .crm-menu { inset-inline-end: 8px; }
  .screen { padding-bottom: 40px; }
}

/* ===== طباعة الكشف ===== */
@media print {
  .crm-side, .crm-top, .crm-tabs, .crm-backdrop, .notif-panel, .acct-actions, .acct-post, .kpi-seg, .acct-people-tools, .otp-box, .staff-verify { display: none !important; }
  #app, .crm-main, .content { max-width: none !important; padding: 0 !important; background: #fff !important; }
  .acct-tw { overflow: visible; border: 0; }
  .acct-t th { position: static; }
}

/* زر «الطلبات بترن» للكادر: سطر واحد مرتّب */
#onduty-btn { align-items: stretch; }
#onduty-btn .btn { margin: 0; font-size: .9rem; line-height: 1.4; padding: 10px 12px; min-height: 48px !important; }
#onduty-btn .btn:last-child { flex: none; width: auto; }

.crm-alert.info { background: var(--info-bg); color: var(--brand-text); }
/* الدرج المسكّر ما بياخد عرض عالموبايل (لقطات headless كانت تنقص) */
@media (max-width: 999px) { html, body { overflow-x: hidden; } .crm-side { transition: transform .22s ease, visibility .22s; } .crm-side:not(.open) { visibility: hidden; } }

/* ===== قسم الخدمات: حالة كل خدمة وخيار، أقسام الرئيسية، الترتيب ===== */
.ms.rot { transform: rotate(180deg); }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.svc-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.svc-stat { padding: 4px 11px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; color: var(--text-2); }
.svc-stat.on { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.svc-stat.soon { background: #fff3dc; color: #9a5b00; border-color: transparent; }
.svc-stat.off { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.svc-pink { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; border: 1px solid #f3c1d6; background: #fdf1f6; margin-bottom: 6px; }
.svc-pink small { display: block; color: var(--muted, #5b6d6d); margin-top: 2px; line-height: 1.7; }
html[data-theme="dark"] .svc-pink { background: #2b1822; border-color: #5a2f44; }
.svc-sec { margin-top: 14px; }
.svc-sec .section-title { display: flex; align-items: center; gap: 8px; }
.svc-sec .section-title small { color: var(--text-2); font-weight: 600; font-size: .8rem; }
.svc-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.svc-card.st-off { opacity: .75; }
.svc-card.st-soon { border-color: #f3c77a; }
.svc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.svc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.svc-ic .ms { font-size: 1.45rem; }
.svc-name { flex: 1; min-width: 150px; }
.svc-name b { display: block; }
.svc-name small { color: var(--text-2); font-size: .78rem; }
.svc-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.svc-tools select { padding: 6px 8px; border-radius: 10px; border: 1.5px solid var(--line); font: inherit; font-size: .82rem; background: #fff; max-width: 160px; }
.svc-arrow { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; width: 32px; height: 32px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); padding: 0; }
.svc-arrow .ms { font-size: 1.25rem; }
.svc-arrow:disabled { opacity: .3; cursor: default; }
.svc-arrow.danger { color: var(--danger); }
.svc-ud { display: flex; gap: 4px; flex: none; }
.seg.sm button { padding: 4px 9px; font-size: .76rem; }
.seg button.on.soon { background: #e0921a; }
.seg button.on.off { background: var(--danger); }
.svc-soon-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; padding: 10px; border-radius: 12px; background: #fff8ea; border: 1px dashed #f3c77a; }
.svc-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 700; color: var(--text); flex-direction: row; }
.svc-lbl .ms { font-size: 1.1rem; color: #9a5b00; }
.svc-soon-box input[type=date], .svc-soon-box input[type=text] { padding: 7px 10px; border-radius: 10px; border: 1.5px solid var(--line); font: inherit; font-size: .85rem; background: #fff; }
.svc-soon-box input[type=text] { flex: 1; min-width: 180px; }
.svc-soon-box input[type=checkbox] { width: 18px; height: 18px; accent-color: #e0921a; }
.svc-more { background: none; border: 0; color: var(--brand-text); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; padding: 8px 0 2px; display: inline-flex; align-items: center; gap: 4px; }
.svc-opts { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 4px; }
.svc-opt { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.svc-opts > .svc-opt:last-child { border-bottom: 0; }
.svc-opt .svc-name { min-width: 120px; }
.svc-opt.st-off .svc-name b { text-decoration: line-through; opacity: .6; }
.svc-opt-group { font-size: .76rem; color: var(--text-2); font-weight: 800; margin: 8px 0 0; }
.svc-log { margin-top: 18px; }
.svc-log ul { list-style: none; margin: 0; padding: 0; }
.svc-log li { font-size: .82rem; color: var(--text-2); padding: 5px 0; border-bottom: 1px dashed var(--line); }
.svc-log li b { color: var(--text); }
.svc-secs-edit .row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.svc-secs-edit input[type=text] { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1.5px solid var(--line); font: inherit; }
@media (max-width: 640px) { .svc-tools { width: 100%; margin-inline-start: 0; } .svc-name { min-width: 0; } }
@media print { .svc-tools, .svc-more, .svc-head button { display: none !important; } }
a.menu-row { text-decoration: none; color: var(--text-2); }

/* الجرس: القائمة بتتمرّر (كانت تنقص بعد ~٩ تنبيهات لأنو عنصر الفليكس ما بيصغر عن محتواه) + التنبيهات السابقة */
.notif-panel { max-height: min(84vh, 780px); }
.np-list { flex: 1 1 auto; min-height: 0; overscroll-behavior: contain; }
.np-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.np-more { border: 0; background: transparent; color: var(--brand-text); font: inherit; font-weight: 800; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; }
.np-more:hover { background: var(--card-2); }
.np-foot-n { font-size: .75rem; color: var(--muted); }
.np-sub { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .85rem; color: var(--muted); padding: 8px 10px 4px; }
.np-item.hist { cursor: default; } .np-item.hist .np-ic { background: var(--card-2); color: var(--muted); }
/* تصدير البيانات + سجل الرسائل */
.exr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exr-top .sk-tag { margin-inline-start: auto; }
.sk-tag.ok { background: var(--ok); color: #fff; } .sk-tag.bad { background: var(--danger); color: #fff; }
.exr-log { display: grid; gap: 4px; }
.exr-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .85rem; padding: 6px 8px; border-radius: 10px; background: var(--card-2); }
.exr-line > span:first-child { color: var(--muted); font-size: .75rem; }
.tm-text { white-space: pre-wrap; margin-top: 6px; }
.tm-item { margin-bottom: 8px; }

/* ===== شات الفريق الداخلي ===== */
.tc-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; height: calc(100dvh - 150px); min-height: 420px; }
.tc-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-y: auto; padding: 8px; }
.tc-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 10px; }
.tc-room { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: transparent; padding: 9px 8px; border-radius: 12px; font-family: inherit; text-align: start; cursor: pointer; color: var(--text); }
.tc-room:hover { background: var(--card-2); } .tc-room.on { background: var(--brand-soft); }
.tc-room .np-ic { position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.tc-room > div { flex: 1; min-width: 0; } .tc-room > div b { display: block; font-size: .9rem; } .tc-room > div span { display: block; font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-dot { position: absolute; bottom: -2px; inset-inline-end: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 2px solid var(--card); }
.tc-when { font-size: .68rem; color: var(--muted); flex: none; }
.tc-thread { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; min-height: 0; }
.tc-empty { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 24px; } .tc-empty .ms { font-size: 2.6rem; color: var(--line-strong); display: block; margin-bottom: 8px; }
.tc-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); } .tc-head > div { display: flex; flex-direction: column; min-width: 0; } .tc-head b { font-size: .95rem; }
.tc-head .np-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.tc-back { display: none; } html[dir="rtl"] .tc-back .ms { transform: none; }
.tc-body { flex: 1; min-height: 0; } .tc-foot { border-top: 1px solid var(--line); }
.tc-msg .tc-from { display: block; font-size: .74rem; color: var(--brand-text); margin-bottom: 2px; } .tc-msg .tc-from span { color: var(--muted); font-weight: 400; }
.tc-day { align-self: center; font-size: .7rem; color: var(--muted); background: var(--card-2); padding: 3px 10px; border-radius: 999px; margin: 6px 0; }
@media (max-width: 760px) {
  .tc-wrap { grid-template-columns: 1fr; height: calc(100dvh - 130px); }
  .tc-wrap.thread .tc-list { display: none; } .tc-wrap:not(.thread) .tc-thread { display: none; }
  .tc-back { display: grid; }
}
/* الشركات والعقود */
.co-list { display: grid; gap: 10px; }
.co-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card, #fff); cursor: pointer; text-align: start; font: inherit; color: var(--text); width: 100%; }
.co-item:hover { border-color: var(--brand, #0a4d63); }
.co-item .grow { flex: 1; min-width: 0; }
.co-item b { display: block; font-size: .98rem; }
.co-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); flex: none; }
.co-ic .ms { color: var(--brand-text); }
.co-st { font-size: .74rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: #f2f4f7; color: #475467; white-space: nowrap; }
.co-st.active { background: #ecfdf3; color: #05603a; }
.co-st.ended { background: #fef3f2; color: #b42318; }
.co-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 12px; }
.co-grid .wide { grid-column: 1 / -1; }
.co-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 600; }
.co-grid input, .co-grid select, .co-grid textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-weight: 400; background: var(--card, #fff); color: var(--text); }
.co-grid textarea { min-height: 70px; resize: vertical; }
.co-files { display: flex; flex-direction: column; }
.co-file { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.co-file:first-child { border-top: 0; }
.co-file .grow { flex: 1; min-width: 160px; }
.co-file .ms.k { color: var(--brand-text); }
.co-up { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.co-up select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
/* نافذة «أرسل الملف» (عقود الموظفين والشركات) */
.sh-wrap { position: fixed; inset: 0; z-index: 990; background: rgba(16,24,40,.55); display: grid; place-items: center; padding: 16px; }
.sh-box { background: var(--card, #fff); color: var(--text); border-radius: 18px; width: min(480px, 100%); max-height: 92vh; overflow: auto; padding: 16px 18px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.sh-box h3 { margin: 0 0 4px; font-size: 1.02rem; display: flex; gap: 6px; align-items: center; }
.sh-box .wa-l { margin-top: 10px; }
.sh-link { display: flex; gap: 6px; margin-top: 10px; }
.sh-link input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: .78rem; direction: ltr; background: var(--card-2); color: var(--text); }

/* ✨ مساعد العقود (2026-11-23) */
.co-ai { margin-top: 14px; padding: 12px; border: 1px dashed var(--brand, #0e7c86); border-radius: 12px; background: color-mix(in srgb, var(--brand, #0e7c86) 5%, transparent); display: flex; flex-direction: column; gap: 8px; }
.co-ai label { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; font-weight: 700; }
.co-ai textarea { width: 100%; min-height: 56px; font: inherit; }
.co-ai > .mini-btn { align-self: flex-start; }
.co-ai-res { background: var(--card, #fff); border-radius: 10px; padding: 10px 12px; font-size: .88rem; line-height: 1.7; }
.co-ai-res ul, .co-ai-res ol { margin: 4px 0; padding-inline-start: 20px; }
.co-ai-res s { color: #98a2b3; }
.co-ai-warn { color: #9a6700; margin: 6px 0; }

/* ===== 📊 لوحة الأرقام (js/crm-dash.js) — طابع زجاجي بهوية دكتور هوم (طلب المالك 2026-11-25) =====
   ألوان السلاسل من اللوحة المعتمدة (أزرق/برتقالي/أكوا، أول ٣ خانات صالحة لعمى الألوان) — النص دايماً بلون النص مو لون السلسلة. */
.dsh { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #8a8f98; margin-bottom: 26px; }
html[data-theme="dark"] .dsh { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #9aa1aa; }
.dsh-hero { position: relative; overflow: hidden; border-radius: 22px; padding: 20px 20px 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(47,196,230,.55) 0%, rgba(47,196,230,0) 55%),
              radial-gradient(90% 120% at 0% 100%, rgba(31,174,130,.45) 0%, rgba(31,174,130,0) 60%),
              linear-gradient(135deg, #06303f 0%, #0a4d63 45%, #0f6f8c 100%);
  box-shadow: 0 10px 30px rgba(6,48,63,.25); }
.dsh-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0) 40%); pointer-events: none; }
.dsh-h-row { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dsh-title { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.dsh-sub { margin: 4px 0 0; font-size: .85rem; color: rgba(255,255,255,.78); }
.dsh-live { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; padding: 6px 11px; border-radius: 99px;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dsh-live i { width: 8px; height: 8px; border-radius: 50%; background: #6fe3b9; box-shadow: 0 0 0 0 rgba(111,227,185,.6); animation: dshPulse 2s infinite; }
@keyframes dshPulse { 70% { box-shadow: 0 0 0 7px rgba(111,227,185,0); } 100% { box-shadow: 0 0 0 0 rgba(111,227,185,0); } }
.dsh-stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.dsh-stat { display: flex; flex-direction: column; gap: 3px; padding: 14px 15px; border-radius: 16px;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18); transition: transform .18s ease, background .18s ease; }
.dsh-stat:hover { transform: translateY(-2px); background: rgba(255,255,255,.18); }
.dsh-st-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 6px; }
.dsh-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.2); }
.dsh-ic .ms { font-size: 1.15rem; color: #fff; }
.dsh-v { font-size: 1.75rem; font-weight: 800; line-height: 1.1; color: #fff; }
.dsh-l { font-size: .85rem; font-weight: 700; color: rgba(255,255,255,.92); }
.dsh-s { font-size: .74rem; color: rgba(255,255,255,.7); }
.dsh-pill { display: inline-flex; align-items: center; gap: 2px; font-size: .7rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.2); color: #fff; white-space: nowrap; }
.dsh-pill .ms { font-size: .85rem; }
.dsh-pill.up { background: rgba(111,227,185,.25); color: #c9f7e6; }
.dsh-pill.down { background: rgba(255,150,150,.25); color: #ffe0e0; }
.dsh-empty { margin: 12px 4px 0; }
.dsh-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
.dsh-wide { grid-column: 1 / -1; }
.dsh-card { background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line); border-radius: 20px; padding: 16px 16px 14px;
  box-shadow: 0 1px 2px rgba(10,77,99,.05), 0 8px 24px rgba(10,77,99,.06); min-width: 0; }
.dsh-c-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.dsh-c-h h3 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--text); }
.dsh-c-h p { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.dsh-legend { display: flex; gap: 12px; font-size: .8rem; color: var(--text-2); }
.dsh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dsh .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dsh .sw.s1, .dsh .sw.c1 { background: var(--s1); } .dsh .sw.s2, .dsh .sw.c2 { background: var(--s2); }
.dsh .sw.c3 { background: var(--s3); } .dsh .sw.c4 { background: var(--s4); }
.dsh-chart { position: relative; }
.dsh-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.dsh-grid-l { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.dsh-ax { font-size: 11px; fill: var(--muted); }
.dsh-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.dsh-line.s1 { stroke: var(--s1); } .dsh-line.s2 { stroke: var(--s2); }
.dsh-g1a { stop-color: var(--s1); stop-opacity: .22; } .dsh-g1b { stop-color: var(--s1); stop-opacity: 0; }
.dsh-end { stroke: var(--card); stroke-width: 2; vector-effect: non-scaling-stroke; }
.dsh-end.s1 { fill: var(--s1); } .dsh-end.s2 { fill: var(--s2); }
.dsh-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.dsh-bar { fill: var(--s1); opacity: .75; } .dsh-bar.cur { opacity: 1; }
.dsh-tip { position: absolute; top: 4px; z-index: 3; pointer-events: none; display: flex; flex-direction: column; gap: 3px; min-width: 130px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); font-size: .78rem; color: var(--text); }
.dsh-tip b { font-size: .8rem; margin-bottom: 2px; }
.dsh-tip span { display: flex; align-items: center; gap: 6px; } .dsh-tip em { margin-inline-start: auto; font-style: normal; font-weight: 800; }
.dsh-tbl { margin-top: 8px; } .dsh-tbl summary { cursor: pointer; font-size: .8rem; color: var(--brand-text); font-weight: 700; }
.dsh-donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dsh-donut svg { width: 140px; height: 140px; flex: none; }
.dsh-seg { fill: none; stroke-width: 18; }
.dsh-seg.c1 { stroke: var(--s1); } .dsh-seg.c2 { stroke: var(--s2); } .dsh-seg.c3 { stroke: var(--s3); } .dsh-seg.c4 { stroke: var(--s4); }
.dsh-dn-v { font-size: 22px; font-weight: 800; fill: var(--text); } .dsh-dn-l { font-size: 11px; fill: var(--muted); }
.dsh-dn-leg { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 140px; }
.dsh-dn-leg li { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-2); }
.dsh-dn-leg b { margin-inline-start: auto; color: var(--text); } .dsh-dn-leg em { font-style: normal; font-size: .75rem; color: var(--muted); min-width: 28px; text-align: end; }
.dsh-foot { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: .76rem; color: var(--muted); }
.dsh-foot .ms { font-size: 1rem; }
.dsh-fun { display: grid; gap: 12px; }
.dsh-fun-t { display: flex; align-items: baseline; gap: 8px; font-size: .85rem; color: var(--text-2); margin-bottom: 5px; }
.dsh-fun-t b { font-size: 1.05rem; color: var(--text); } .dsh-fun-t em { margin-inline-start: auto; font-style: normal; font-size: .75rem; color: var(--muted); }
.dsh-fun-b { display: flex; height: 10px; border-radius: 6px; background: var(--card-2); overflow: hidden; }
.dsh-fun-b i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(270deg, var(--brand-3), var(--brand)); }
/* حركة الدخول متل الفيديو: البطاقات بتطلع وحدة ورا التانية */
@media (prefers-reduced-motion: no-preference) {
  .dsh-stat, .dsh-card { animation: dshUp .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 70ms); }
  @keyframes dshUp { from { opacity: 0; transform: translateY(14px); } }
}
@media (max-width: 560px) { .dsh-hero { padding: 16px 14px; border-radius: 18px; } .dsh-stats { grid-template-columns: 1fr 1fr; gap: 8px; } .dsh-v { font-size: 1.4rem; } .dsh-ax { font-size: 20px; } }
@media print { .dsh-hero { box-shadow: none; } .dsh-stat, .dsh-card { animation: none; } }
