/* محادثات نواة (خطة-المحادثات.md): «رسائلي» للعميل و«صندوق الفريق». بألوان الموقع وحقوله (styles.css).
   رسائلك في جهة النهاية (اليسار في العربية) بلون النعناع الخافت، ورسائل الفريق في جهة البداية، وملاحظات النظام في الوسط.
   خانة الكتابة طبقة شفافة ثابتة أسفل الشاشة فوق لوحة المفاتيح، والمحتوى يمر تحتها (apple-design: المواد والعمق) */
.nc { padding-block: 16px 0; } /* الترويسة تأخذ مكانها في الصفحة، فلا نضيف ارتفاعها مرة ثانية */
/* الصفحة بطول الشاشة على الأقل، فتبقى خانة الكتابة في أسفلها حتى مع رسائل قليلة */
.nc > .container { display: flex; flex-direction: column; min-height: calc(100vh - var(--header-h) - 16px); min-height: calc(100svh - var(--header-h) - 16px); }
#nc-pane { flex: 1 0 auto; }
.nc-composer { margin-top: auto; }
.team-grid { flex: 1 0 auto; }
.team-pane { display: flex; flex-direction: column; min-height: calc(100svh - var(--header-h) - 120px); }
.team-pane .nc-log { flex: 1 0 auto; }
.nc-wrap { max-width: 820px; }
.nc-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.nc-head h1 { font-family: var(--font-display); font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); line-height: 1.25; }
.nc-head .kicker { margin-bottom: 6px; }
.nc-promise { margin-top: 4px; color: var(--text-2); font-size: var(--fs-small); }
.nc-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); }
.nc-tabs button { min-height: 40px; padding: 6px 16px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--text-2); font: inherit; font-size: var(--fs-small); cursor: pointer; }
.nc-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--text); font-weight: 700; }
.nc-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* تنبيه الردود والمشاريع */
.nc-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text-2); font-size: var(--fs-small); line-height: 1.7; }
.nc-note p { flex: 1 1 260px; }
.nc-projects { display: grid; gap: 10px; margin-top: 14px; }
.nc-project { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.nc-project-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.nc-project b { font-size: var(--fs-body); }
.nc-code { direction: ltr; unicode-bidi: isolate; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.04em; }
.nc-stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 10px; list-style: none; padding: 0; }
.nc-stages li { height: 6px; border-radius: 3px; background: var(--line-strong); }
.nc-stages li.is-done { background: var(--accent); }
.nc-stages li.is-now { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nc-stage-name { color: var(--text-2); font-size: var(--fs-small); }
.nc-checklist { margin-top: 12px; display: grid; gap: 2px; }
.nc-checklist h3 { font-size: var(--fs-small); color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.nc-check { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 6px 0; cursor: pointer; line-height: 1.6; }
.nc-check input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); }
.nc-check.is-done span { color: var(--text-3); text-decoration: line-through; }

/* الخيط */
.nc-log { list-style: none; margin: 0; padding: 18px 0 24px; display: flex; flex-direction: column; gap: 6px; min-height: 40vh; }
.nc-day { align-self: center; margin: 12px 0 6px; padding: 2px 12px; border-radius: var(--radius-pill); background: var(--surface); color: var(--text-3); font-size: 0.8125rem; }
.nc-msg { max-width: min(82%, 560px); display: grid; gap: 4px; }
.nc-msg--them { align-self: flex-start; }
.nc-msg--me { align-self: flex-end; }
.nc-bubble { padding: 10px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.nc-msg--me .nc-bubble { background: rgba(61, 220, 151, 0.14); border-color: rgba(61, 220, 151, 0.26); border-end-end-radius: 6px; }
.nc-msg--them .nc-bubble { border-end-start-radius: 6px; }
.nc-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.nc-req-title { display: block; margin-bottom: 6px; color: var(--accent); font-size: var(--fs-small); }
.nc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-inline: 6px; color: var(--text-3); font-size: 0.8125rem; }
.nc-msg--me .nc-meta { justify-content: flex-end; }
.nc-meta .nc-tag { padding: 0 8px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); }
.nc-meta svg { width: 14px; height: 14px; fill: currentColor; }
.nc-meta .is-read { color: var(--accent); }
.nc-sys { align-self: center; max-width: 90%; margin: 6px 0; padding: 6px 14px; border-radius: 12px; background: var(--surface); color: var(--text-2); font-size: var(--fs-small); text-align: center; line-height: 1.7; }
.nc-sys .nc-code { color: var(--text); }

/* الملفات داخل الخيط */
.nc-img { display: block; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.nc-img img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
.nc-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.nc-file-ext { flex: 0 0 auto; display: grid; place-items: center; min-width: 48px; height: 48px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; direction: ltr; }
.nc-file-info { min-width: 0; display: grid; gap: 2px; }
.nc-file-info b { overflow-wrap: anywhere; font-weight: 500; }
.nc-file-info small { color: var(--text-3); }
.nc-file-acts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-inline-start: auto; }
.nc-link { min-height: 40px; padding: 6px 2px; border: 0; background: none; color: var(--accent); font: inherit; font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; display: inline-flex; align-items: center; }
.nc-link--danger { color: var(--danger); }
.nc-deleted { color: var(--text-3); font-style: italic; }

/* بطاقة عرض السعر */
.nc-quote { padding: 16px; border: 1px solid rgba(61, 220, 151, 0.35); border-radius: 18px; background: linear-gradient(180deg, rgba(61, 220, 151, 0.08), transparent 70%), var(--surface); }
.nc-quote h3 { color: var(--text-2); font-size: var(--fs-small); font-weight: 500; }
.nc-quote-amount { margin-top: 4px; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.3; }
.nc-quote p { margin-top: 6px; color: var(--text-2); white-space: pre-wrap; line-height: 1.7; }
.nc-quote-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.nc-quote-state { margin-top: 12px; color: var(--accent); font-weight: 500; }
.nc-quote.is-replaced { opacity: 0.6; border-color: var(--line); }
.nc-quote.is-replaced .nc-quote-state { color: var(--text-3); }

.nc-empty { margin: 32px auto; max-width: 440px; color: var(--text-2); text-align: center; line-height: 1.8; }
.nc-empty b { display: block; margin-bottom: 6px; color: var(--text); font-size: var(--fs-sub); }

/* «ملفات المشروع» */
.nc-files-pane { padding: 18px 0 32px; }
.nc-files-group + .nc-files-group { margin-top: 24px; }
.nc-files-group h2 { font-size: var(--fs-body); margin-bottom: 10px; }
.nc-files-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 560px) { .nc-files-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nc-files-grid .nc-file { flex-direction: column; align-items: stretch; height: 100%; }
.nc-files-grid .nc-file-acts { margin-inline-start: 0; }
.nc-thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 10px; background: var(--surface-2); }
.nc-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* خانة الكتابة: ثابتة أسفل الشاشة، والمحتوى يمر تحتها */
.nc-composer { position: sticky; bottom: 0; z-index: 20; margin-inline: calc(var(--gutter) * -1); padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(11, 16, 34, 0.82); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.nc-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.nc-composer-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; font-size: var(--fs-small); color: var(--text-2); }
.nc-composer-top .select { width: auto; max-width: 100%; min-height: 36px; padding-block: 4px; padding-inline: 14px 40px; font-size: var(--fs-small); } /* السهم في جهة النهاية لا يغطي النص */
.nc-input { flex: 1 1 auto; min-height: 48px; max-height: 40vh; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); color: var(--text); font: inherit; line-height: 1.5; resize: none; overflow-y: auto; }
.nc-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nc-icon-btn { flex: 0 0 auto; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; transition: transform 0.1s ease-out, background-color 0.15s; }
.nc-icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.nc-icon-btn:active { transform: scale(0.94); }
.nc-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nc-send { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.nc-send svg { transform: scaleX(-1); } /* السهم يشير لجهة الإرسال في العربية */
.nc-send:disabled { opacity: 0.5; cursor: default; }
.nc-attach-menu { position: absolute; bottom: calc(100% + 8px); inset-inline-start: var(--gutter); display: grid; min-width: 230px; padding: 6px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface-2); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); transform-origin: bottom right; }
.nc-attach-menu button { display: grid; gap: 2px; min-height: 48px; padding: 8px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.nc-attach-menu button small { color: var(--text-3); font-size: 0.8125rem; }
.nc-attach-menu button:hover, .nc-attach-menu button:focus-visible { background: var(--surface); outline: none; }
.nc-error { margin-top: 6px; color: var(--danger); font-size: var(--fs-small); }
.nc-error:empty { display: none; }
.nc-uploads { display: grid; gap: 6px; margin-bottom: 8px; }
.nc-uploads:empty { display: none; }
.nc-upload { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: var(--fs-small); }
.nc-upload span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-upload progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.nc-upload.is-error { border-color: rgba(255, 138, 128, 0.5); }
.nc-upload.is-error em { grid-column: 1 / -1; color: var(--danger); font-style: normal; }

/* صندوق الفريق: قائمة العملاء والخيط جنبًا إلى جنب على الكمبيوتر، وواحد بعد الآخر على الجوال */
.team-wrap { max-width: 1200px; }
.team-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 24px; align-items: start; margin-top: 16px; }
.team-side { position: sticky; top: calc(var(--header-h) + 12px); display: grid; gap: 10px; max-height: calc(100vh - var(--header-h) - 24px); overflow: auto; padding-bottom: 12px; }
.team-search { position: relative; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.team-item { display: grid; gap: 2px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.team-item[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.team-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team-item b { overflow-wrap: anywhere; }
.team-item small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-unread { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 0.75rem; font-weight: 700; line-height: 22px; text-align: center; }
.team-empty { color: var(--text-2); font-size: var(--fs-small); line-height: 1.7; }
.team-card { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.team-card-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.team-card-top h2 { font-size: var(--fs-sub); }
.team-phone { direction: ltr; unicode-bidi: isolate; color: var(--text-2); }
.team-tools { display: grid; gap: 8px; }
.team-tools details { border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.team-tools summary { min-height: 44px; padding: 10px 14px; cursor: pointer; font-weight: 500; }
.team-tools .form { display: grid; gap: 12px; padding: 4px 14px 14px; }
.team-back { display: none; }
.team-pane[hidden], .team-side[hidden] { display: none !important; }

@media (max-width: 860px) {
  .team-grid { grid-template-columns: 1fr; }
  .team-side { position: static; max-height: none; }
  .team-back { display: inline-flex; }
}
@media (max-width: 560px) {
  .nc-msg { max-width: 90%; }
  .nc-tabs { width: 100%; }
  .nc-tabs button { flex: 1 1 0; }
}
@media (prefers-reduced-transparency: reduce) {
  .nc-composer { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nc-icon-btn { transition: none; }
  .nc-icon-btn:active { transform: none; }
}

/* بعد v45 (خطة-تحسين-الدردشة.md، المرحلة 1) */
.nc-log:empty { min-height: 0; padding: 0; } /* لا فراغ فوق الحالة الفارغة */
.nc-quote .nc-quote-amount { color: var(--text); } /* أهم رقم في البطاقة بلون النص لا الرمادي */
.nc-req { white-space: normal; }
.nc-req-h { display: block; margin-top: 10px; font-size: var(--fs-small); color: var(--text-2); }
.nc-req-list { margin: 4px 0 0; padding-inline-start: 18px; display: grid; gap: 2px; }
.nc-req-k { color: var(--text-2); }
.nc-req p + p { margin-top: 6px; }
.team-grid { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); } /* العمود لا يتسع بقائمة «ردود جاهزة» الطويلة */
.team-pane { min-width: 0; }
@media (max-width: 860px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }
.nc-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.nc-starters .chip { color: var(--text); }
/* «الاتصال منقطع»: تحت الترويسة في كل الحالات (المحادثة والملفات والقائمة)، ويختفي مع أول نجاح */
.nc-offline { position: fixed; z-index: 30; top: calc(var(--header-h) + 10px); inset-inline: var(--gutter); width: fit-content; max-width: calc(100% - 2 * var(--gutter)); margin-inline: auto; padding: 8px 16px; border: 1px solid rgba(255, 138, 128, 0.45); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font-size: var(--fs-small); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.nc-offline[hidden] { display: none; }

/* المرحلة 2 (خطة-تحسين-الدردشة.md): تجربة تطبيق محادثة */
/* رأس مدمج: «فريق نواة» بعلامة المدار، وسطر الإتاحة، والجرس، والتبويبان (سطر واحد على الشاشات العريضة) */
.nc-head { align-items: center; padding-bottom: 12px; }
.nc-id { display: flex; align-items: center; gap: 12px; flex: 1 1 300px; min-width: 0; }
.nc-id > div { flex: 1 1 auto; min-width: 0; }
.nc-avatar { flex: none; width: 44px; height: 44px; padding: 7px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); }
.nc-head h1 { font-size: var(--fs-sub); line-height: 1.3; }
.nc-head .nc-promise { margin-top: 2px; line-height: 1.6; }
.nc-bell { width: 44px; height: 44px; }
.nc-bell.is-on { border-color: rgba(61, 220, 151, 0.45); color: var(--accent); }

/* شريط المشروع المطوي: ثابت تحت الترويسة، بطبقة شفافة كخانة الكتابة */
.nc-proj { position: sticky; top: var(--header-h); z-index: 15; margin: 10px calc(var(--gutter) * -1) 0; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); background: rgba(11, 16, 34, 0.86); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.nc-proj > summary { position: relative; display: grid; gap: 8px; min-height: 48px; padding: 10px 0; padding-left: 28px; list-style: none; cursor: pointer; }
.nc-proj > summary::-webkit-details-marker { display: none; }
.nc-proj > summary::after { content: ""; position: absolute; left: 6px; top: 16px; width: 8px; height: 8px; border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2); transform: rotate(45deg); transition: transform 0.2s ease-out; }
.nc-proj[open] > summary::after { transform: translateY(4px) rotate(-135deg); }
.nc-proj > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.nc-proj-line { font-size: var(--fs-small); line-height: 1.6; }
.nc-proj-bar { display: block; height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.nc-proj-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s ease-out; }
.nc-proj .nc-projects { margin: 0 0 12px; max-height: 60vh; overflow: auto; }
.nc-files-mode .nc-proj, .nc-files-mode #nc-push { display: none; }

/* تتابع رسائل الشخص نفسه: أقرب لبعض، وسطر الوقت تحت آخرها، و«الذيل» في آخر فقاعة فقط */
.nc-msg.nc-cont { margin-top: -3px; }
.nc-msg:not(.nc-run-end) > .nc-meta { display: none; }
.nc-msg--me .nc-bubble, .nc-msg--them .nc-bubble { border-end-end-radius: 18px; border-end-start-radius: 18px; }
.nc-msg--me.nc-run-end .nc-bubble { border-end-end-radius: 6px; }
.nc-msg--them.nc-run-end .nc-bubble { border-end-start-radius: 6px; }
.nc-receipt:not(.is-last) { display: none; }
.nc-one-code .nc-tag { display: none; }

/* الإرسال الفوري */
.nc-pending .nc-meta { color: var(--text-3); }
.nc-pending.is-failed .nc-bubble { border-color: rgba(255, 138, 128, 0.55); }
.nc-failed { color: var(--danger); }

/* «رسائل جديدة»: فاصل عند أول رسالة لم تُقرأ، وزر يرجعك للأسفل */
.nc-new { display: flex; align-items: center; gap: 12px; margin: 10px 0 4px; color: var(--accent); font-size: 0.8125rem; font-weight: 700; }
.nc-new::before, .nc-new::after { content: ""; flex: 1; height: 1px; background: rgba(61, 220, 151, 0.35); }
.nc-jump { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 16px; border: 1px solid rgba(61, 220, 151, 0.45); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-small); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); cursor: pointer; }
.nc-jump svg { width: 16px; height: 16px; fill: currentColor; transform: rotate(-90deg); }
.nc-jump:active { transform: translateX(-50%) scale(0.96); }

/* «ملفات المشروع»: الفرز */
.nc-file-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.nc-file-filter .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* عارض الصور: يملأ الشاشة، والخلفية تخفت مع السحب (--drag من 0 إلى 1) */
.nc-viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 8, 18, calc(0.94 - var(--drag, 0) * 0.6)); color: var(--text); opacity: 0; transition: opacity 0.18s ease-out; }
.nc-viewer::backdrop { background: transparent; }
.nc-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.nc-viewer.is-in { opacity: 1; }
.nc-viewer-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px; }
.nc-viewer figure { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 0; margin: 0; padding: 0 var(--gutter) calc(16px + env(safe-area-inset-bottom)); }
.nc-viewer img { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 12px; touch-action: pinch-zoom; -webkit-user-drag: none; user-select: none; cursor: grab; scale: 0.96; transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), scale 0.22s ease-out; }
.nc-viewer.is-in img { scale: 1; }
.nc-viewer img.is-drag { transition: none; cursor: grabbing; }
.nc-viewer figcaption { color: var(--text-2); font-size: var(--fs-small); text-align: center; }

@media (max-width: 560px) {
  .nc-head .nc-tabs { width: 100%; }
}
@media (prefers-reduced-transparency: reduce) {
  .nc-proj { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nc-viewer, .nc-viewer img, .nc-proj-bar i, .nc-proj > summary::after { transition: none; }
  .nc-viewer img { scale: 1; }
}

/* المرحلة 3 (خطة-تحسين-الدردشة.md): لوحة المشروع */
/* المراحل بأسمائها على الشاشات العريضة، و«الآن / بعدها» على الجوال. الحالية بخط أعرض بدل الهالة */
.nc-stages li, .nc-stages li.is-done, .nc-stages li.is-now { display: grid; gap: 6px; height: auto; background: none; box-shadow: none; }
.nc-stage-bar { display: block; height: 6px; border-radius: 3px; background: var(--line-strong); }
.nc-stages .is-done .nc-stage-bar, .nc-stages .is-now .nc-stage-bar { background: var(--accent); }
.nc-stage-label { color: var(--text-3); font-size: 0.75rem; line-height: 1.4; text-align: center; }
.nc-stages .is-done .nc-stage-label { color: var(--text-2); }
.nc-stages .is-now .nc-stage-label { color: var(--text); font-weight: 700; }
.nc-stage-next { display: none; margin-top: 8px; color: var(--text-2); font-size: var(--fs-small); }
.nc-turn { margin-top: 6px; color: var(--text-2); font-size: var(--fs-small); }
.nc-turn.is-open { color: var(--text); font-weight: 500; }
@media (max-width: 560px) {
  .nc-stage-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nc-stage-next { display: block; }
}

/* «ناقصنا منك»: لكل بند «ارفع الملف»، وما وصل له رابطه */
.nc-check-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; border-bottom: 1px solid var(--line); }
.nc-check-row:last-child { border-bottom: 0; }
.nc-check-row .nc-check { flex: 1 1 200px; }
.nc-check-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding-bottom: 6px; }
.nc-item-up { min-height: 40px; font-size: var(--fs-small); }
.nc-item-file { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.nc-item-tag { color: var(--text-3); font-size: 0.8125rem; padding-inline: 6px; }

/* بطاقة العرض: «ما تستلمه» نقاطًا، والصلاحية بهدوء، و«الخطوة التالية» */
.nc-quote-h { margin: 12px 0 0; color: var(--text-2); font-size: var(--fs-small); font-weight: 500; }
.nc-quote-list { margin: 4px 0 0; padding-inline-start: 18px; display: grid; gap: 2px; color: var(--text); line-height: 1.7; }
.nc-quote-valid { color: var(--text-2); font-size: var(--fs-small); }
.nc-quote-valid .nc-link { min-height: 0; padding: 0; font-size: inherit; }
.nc-quote-next { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text); line-height: 1.8; }
.nc-quote.is-expired { border-color: var(--line-strong); }
.nc-quote.is-expired .nc-quote-state { color: var(--text-2); }

/* الرد على رسالة: الاقتباس داخل الفقاعة، وزر «رد» عند المرور، والسحب على الجوال، وسطر «ردًا على» فوق الخانة */
.nc-msg { position: relative; touch-action: pan-y; transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1); }
.nc-msg.is-swiping { transition: none; }
.nc-re { display: grid; gap: 1px; width: 100%; margin-bottom: 6px; padding: 6px 10px; border: 0; border-inline-start: 2px solid var(--accent); border-radius: 8px; background: rgba(255, 255, 255, 0.05); color: var(--text-2); font: inherit; font-size: var(--fs-small); text-align: start; cursor: pointer; white-space: normal; }
.nc-re b { color: var(--text); font-weight: 600; }
.nc-re span:not(.sr-only) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-reply-btn { position: absolute; top: 4px; min-height: 32px; padding: 2px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.8125rem; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.15s ease-out; }
.nc-msg--them .nc-reply-btn { inset-inline-start: calc(100% + 8px); }
.nc-msg--me .nc-reply-btn { inset-inline-end: calc(100% + 8px); }
@media (hover: hover) {
  .nc-msg:hover .nc-reply-btn, .nc-msg:focus-within .nc-reply-btn { opacity: 1; pointer-events: auto; }
}
@media (hover: none) {
  /* على اللمس الرد بالسحب، والزر لقارئ الشاشة ولوحة المفاتيح فقط */
  .nc-reply-btn { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
  .nc-reply-btn:focus-visible { width: auto; height: auto; min-height: 32px; padding: 2px 12px; clip: auto; opacity: 1; inset-inline-end: 0; top: -36px; }
}
.nc-msg.is-flash > .nc-bubble, .nc-msg.is-flash > .nc-quote, .nc-msg.is-flash > .nc-file, .nc-msg.is-flash > .nc-img, .nc-msg.is-flash > div > .nc-img { outline: 2px solid transparent; outline-offset: 2px; animation: nc-flash 1.2s ease-out; }
@keyframes nc-flash { 0%, 30% { outline-color: var(--accent); } 100% { outline-color: transparent; } }
.nc-msg:focus { outline: none; }
.nc-replybar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 6px 6px 6px 0; padding-inline-start: 12px; border-inline-start: 2px solid var(--accent); border-radius: 10px; background: var(--surface); }
.nc-replybar-text { flex: 1 1 auto; min-width: 0; display: grid; font-size: var(--fs-small); }
.nc-replybar-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.nc-reply-x { width: 40px; height: 40px; }
.nc-reply-x svg { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) {
  .nc-msg { transition: none; }
  .nc-msg.is-flash > * { animation: none; }
}

/* المرحلة 4 (خطة-تحسين-الدردشة.md): صندوق الفريق بثلاثة أعمدة على الشاشات العريضة: القائمة، والخيط برأس ثابت، وتفاصيل العميل */
.team-wrap { max-width: 1440px; }
.team-grid { grid-template-columns: minmax(250px, 300px) minmax(0, 1fr) minmax(280px, 320px); gap: 20px; }
.team-stats { color: var(--text-3); }
.team-stats:empty { display: none; }
.team-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.team-filter .chip { min-height: 36px; padding: 4px 12px; font-size: var(--fs-small); }
.team-filter .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.team-wait { color: var(--text) !important; font-weight: 500; }
.team-wait.is-late { color: var(--danger) !important; }
.team-item-typing { color: var(--accent) !important; }

/* رأس العميل الثابت فوق الخيط */
.team-head { position: sticky; top: var(--header-h); z-index: 16; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-inline: -8px; padding: 10px 8px; border-bottom: 1px solid var(--line); background: rgba(11, 16, 34, 0.88); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); }
.team-head-id { flex: 1 1 240px; min-width: 0; }
.team-head h2 { font-size: var(--fs-sub); line-height: 1.3; }
.team-head-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-2); font-size: var(--fs-small); }
.team-head-meta span:empty { display: none; }
.team-typing { color: var(--accent); }
.team-details-btn { display: none; }
.nc-older { display: flex; margin: 14px auto 0; }

/* تفاصيل العميل: عمود ثابت بجانب الخيط */
.team-details { position: sticky; top: calc(var(--header-h) + 12px); display: grid; align-content: start; gap: 12px; max-height: calc(100vh - var(--header-h) - 24px); overflow: auto; padding-bottom: 12px; }
.team-details-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.team-details-head h2 { font-size: var(--fs-body); }
.team-details-x { display: none; width: 40px; height: 40px; }
.team-details-x svg { width: 18px; height: 18px; }
.team-details .team-card { gap: 8px; }
.team-details .nc-projects { margin-top: 0; }
.team-details #team-wa { justify-self: start; }

/* ملاحظات الفريق: حدّ متقطع يميّزها عن رسائل المحادثة، ولا يراها العميل */
.team-notes { display: grid; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--bg); }
.team-notes h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: var(--fs-body); }
.team-notes h3 small { color: var(--text-3); font-size: 0.8125rem; font-weight: 400; }
.team-notes-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.team-note { display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.team-note p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.team-note small { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; color: var(--text-3); }
.team-note .nc-link { min-height: 32px; }
.team-notes-empty { color: var(--text-3); font-size: var(--fs-small); line-height: 1.7; }
.team-notes .form { display: grid; gap: 8px; }
.team-notes .form .btn { justify-self: start; }
.team-keys summary { display: flex; align-items: center; min-height: 44px; color: var(--text-2); font-size: var(--fs-small); cursor: pointer; }
.team-keys ul { margin: 0; padding-inline-start: 18px; color: var(--text-2); font-size: var(--fs-small); line-height: 2; }
kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; }

/* «ناقصنا منك» عند الفريق: حذف بأيقونة مع «تراجع» */
.nc-check-del { width: 36px; height: 36px; }
.nc-check-del svg { width: 16px; height: 16px; }
.nc-check-undo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text-2); font-size: var(--fs-small); }

/* بعد الرد: «نبّهه على واتساب»، و«/» للردود الجاهزة */
.nc-nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-size: var(--fs-small); }
.nc-nudge > span { flex: 1 1 200px; color: var(--text-2); }
.nc-nudge .btn svg { width: 18px; height: 18px; fill: currentColor; margin-inline-end: 6px; }
.nc-qr { list-style: none; margin: 0 0 8px; padding: 6px; display: grid; gap: 2px; max-height: 40vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-2); }
.nc-qr li { padding: 8px 12px; border-radius: 10px; line-height: 1.6; cursor: pointer; }
.nc-qr li[aria-selected="true"], .nc-qr li:hover { background: var(--surface); }

/* أقل من 1200: التفاصيل درج من جهة النهاية بزر «تفاصيل العميل» */
@media (max-width: 1199px) {
  .team-grid { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .team-details-btn { display: inline-flex; }
  .team-details { position: fixed; z-index: 40; top: var(--header-h); bottom: 0; inset-inline-end: 0; width: min(400px, 100%); max-height: none; padding: 16px; border-inline-start: 1px solid var(--line-strong); background: var(--bg); box-shadow: 0 0 0 100vmax rgba(5, 8, 18, 0.55); }
  .team-details:not(.is-open) { display: none; }
  .team-details-x { display: grid; }
}
@media (max-width: 860px) {
  .team-grid { grid-template-columns: minmax(0, 1fr); }
  .team-head { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
}

/* =================================================================
   28 أكتوبر (المرحلة 5 من خطة-تحليل-ونقد-الموقع.md): قسم «الأرقام» للفريق (team-stats.js)
   - مطوي تحت رأس الصندوق، وملخصه في سطر العنوان. المؤشر الرئيسي أكبر رقم في القسم
   - الأشرطة بلون واحد (#25A26D: داخل نطاق الإضاءة على السطح الداكن، وتباينه فوق 3:1)، والأعداد والنسب بألوان النص لا بلون الشريط
   ================================================================= */
.team-numbers { margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); }
.team-numbers[hidden] { display: none; }
.team-numbers > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-height: 48px; padding: 12px 16px; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.team-numbers > summary::-webkit-details-marker { display: none; }
.team-numbers > summary::after { content: ""; align-self: center; margin-inline-start: auto; width: 8px; height: 8px; border: solid var(--text-2); border-width: 0 0 2px 2px; transform: translateY(-2px) rotate(-45deg); transition: transform 0.2s; }
.team-numbers[open] > summary::after { transform: translateY(2px) rotate(135deg); }
.team-numbers > summary:active { opacity: 0.7; }
.tn-title { font-weight: 700; }
.tn-peek { color: var(--text-2); font-size: var(--fs-small); }
.tn-body { display: grid; gap: 18px; padding: 0 16px 16px; }
.tn-range { display: inline-flex; justify-self: start; gap: 4px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 999px; }
.tn-range button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--text-2); font: inherit; font-size: var(--fs-small); cursor: pointer; }
.tn-range button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.tn-range button:active { opacity: 0.7; }
.tn-wait, .tn-empty, .tn-note, .tn-sub { margin: 0; color: var(--text-2); font-size: var(--fs-small); line-height: 1.7; }
.tn-note { color: var(--text-3); }
.tn-sub--line b { color: var(--text); font-variant-numeric: tabular-nums; }
#tn-out { display: grid; gap: 18px; }
.tn-kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tn-kpi { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.tn-kpi--main { border-color: rgba(61, 220, 151, 0.5); }
.tn-k { color: var(--text-2); font-size: var(--fs-small); }
.tn-v { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tn-kpi--main .tn-v { font-size: 2.25rem; }
.tn-s { color: var(--text-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.tn-block { display: grid; gap: 10px; }
.tn-block h3 { margin: 0; font-size: var(--fs-body); }
.tn-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tn-list li { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) 3.5rem; align-items: center; gap: 10px; font-size: var(--fs-small); }
.tn-funnel li { grid-template-columns: minmax(6rem, 9rem) minmax(0, 1fr) 3.5rem 3rem; }
.tn-list b { text-align: end; font-variant-numeric: tabular-nums; }
.tn-list small { color: var(--text-3); text-align: end; font-variant-numeric: tabular-nums; }
.tn-l { overflow: hidden; color: var(--text-2); text-overflow: ellipsis; white-space: nowrap; }
.tn-bar { display: block; height: 10px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); }
.tn-bar i { display: block; height: 100%; border-radius: 4px; background: #25A26D; }
.tn-days { display: flex; align-items: flex-end; gap: 2px; height: 72px; padding-bottom: 1px; border-bottom: 1px solid var(--line); }
.tn-day { flex: 1 1 0; display: flex; align-items: flex-end; height: 100%; }
.tn-day i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: #25A26D; }
.tn-day:hover i { background: var(--accent); }
.tn-cols { display: grid; gap: 18px; }
@media (min-width: 900px) { .tn-cols { grid-template-columns: 1fr 1fr; } }
.tn-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.tn-table th, .tn-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; font-variant-numeric: tabular-nums; }
.tn-table thead th { color: var(--text-2); font-weight: 500; }
@media (max-width: 599px) {
  .tn-list li { grid-template-columns: minmax(6rem, 8rem) minmax(0, 1fr) 3rem; }
  .tn-funnel li { grid-template-columns: minmax(5rem, 6.5rem) minmax(0, 1fr) 2.5rem 2.5rem; }
}
@media (prefers-reduced-motion: reduce) { .team-numbers > summary::after { transition: none; } }

/* الجزء 8.1: المحادثة الفارغة بأيقونة في مربع ملوّن، والبدايات صف واحد يُسحب على الجوال، وزر الطلب لمن لم يطلب بعد */
.nc-empty-ic { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.nc-empty-ic [data-icon] { width: 28px; height: 28px; }
.nc-starters .chip:active { scale: 0.96; }
.nc-empty-cta { margin-top: 18px; }
.nc-empty-cta[hidden] { display: none; }
@media (max-width: 640px) {
  .nc-starters { flex-wrap: nowrap; justify-content: flex-start; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
  .nc-starters::-webkit-scrollbar { display: none; }
  .nc-starters .chip { flex: none; scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) { .nc-starters .chip:active { scale: none; } }

/* =================================================================
   30 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 8.2): الرسائل
   1) شعار نواة الصغير بجانب آخر فقاعة في كل تتابع من الفريق («رسائلي» فقط)، كصورة المرسل في تطبيقات المحادثة
   2) أسطر النظام بأيقونة حسب نوعها، وأسطر المشروع زر يفتح بطاقة المشروع (سهم صغير يدل أنها تنضغط)
   3) شارة اليوم تثبت تحت شريط المشروع أثناء التمرير، بمادة شفافة كالشريط. وكل الشارات بعرض واحد فلا تبين حواف السابقة تحت اللاحقة
   وإصلاح: أيقونة «قرأها الفريق» كانت فوق النص (svg عنصر كتلي في styles.css)
   ================================================================= */
.nc-meta .nc-receipt { display: inline-flex; align-items: center; gap: 3px; }
[data-chat="customer"] .nc-msg--them { padding-inline-start: 38px; max-width: min(calc(82% + 38px), 598px); }
[data-chat="customer"] .nc-msg--them.nc-run-end::before { content: ""; position: absolute; inset-inline-start: 0; bottom: 28px; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; background: url("../img/logo.svg") center / 24px no-repeat, var(--surface-2); }
.nc-sys { padding: 0; background: none; border-radius: 0; }
.nc-sys-in { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 14px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text-2); font: inherit; line-height: 1.7; text-align: start; }
.nc-sys-ic { flex: none; width: 16px; height: 16px; fill: var(--accent); }
.nc-sys-btn { min-height: 40px; cursor: pointer; transition: transform 0.1s ease-out, background-color 0.15s; -webkit-tap-highlight-color: transparent; }
.nc-sys-go { flex: none; width: 14px; height: 14px; fill: var(--text-3); }
.nc-sys-btn:active { transform: scale(0.97); background: var(--surface-2); }
.nc-sys-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .nc-sys-btn:hover { background: var(--surface-2); } }
[data-chat="customer"] .nc-day { position: sticky; top: calc(var(--header-h) + var(--nc-stick, 0px) + 8px); z-index: 5; min-width: 9em; border: 1px solid var(--line); background: rgba(24, 33, 63, 0.86); -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%); color: var(--text-2); text-align: center; }
@media (max-width: 560px) { [data-chat="customer"] .nc-msg--them { max-width: min(calc(90% + 38px), 100%); } }
@media (prefers-reduced-transparency: reduce) { [data-chat="customer"] .nc-day { background: var(--surface-2); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (prefers-reduced-motion: reduce) { .nc-sys-btn { transition: none; } .nc-sys-btn:active { transform: none; } }

/* =================================================================
   30 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 8.3): الكتابة والإرفاق
   1) قائمة الإرفاق كقائمة الإجراءات في iOS: أيقونة في مربع ملوّن، وتنمو من زر «+» (origin-aware، 160ms ease-out)
   2) زر الإرسال هادئ (محيط وأيقونة رمادية) والخانة فارغة، ويصير بلون النعناع مع أول حرف بتكبير خفيف
   3) طبقة «أفلت الملفات هنا» أثناء سحب ملفات فوق المحادثة على الكمبيوتر
   ================================================================= */
.nc-attach-menu { min-width: 260px; max-width: min(360px, calc(100vw - 2 * var(--gutter))); transition: opacity 0.16s cubic-bezier(0.23, 1, 0.32, 1), transform 0.16s cubic-bezier(0.23, 1, 0.32, 1); }
@starting-style { .nc-attach-menu:not([hidden]) { opacity: 0; transform: translateY(6px) scale(0.96); } }
.nc-attach-menu button { display: flex; align-items: center; gap: 12px; transition: background-color 0.12s; }
.nc-attach-menu button:active { background: var(--surface); }
.nc-pick-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.nc-pick-ic--doc { background: rgba(140, 170, 255, 0.14); color: #A9BFFF; }
.nc-pick-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 16; stroke-linecap: round; stroke-linejoin: round; }
.nc-pick-t { display: grid; gap: 2px; min-width: 0; }
.nc-send { transition: transform 0.16s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.15s, border-color 0.15s, color 0.15s; }
.nc-composer.is-empty .nc-send { border-color: var(--line-strong); background: var(--surface); color: var(--text-3); transform: scale(0.92); }
.nc-composer.is-empty .nc-send:active { transform: scale(0.88); }
.nc-drop { position: fixed; z-index: 45; inset: var(--header-h) 0 0; display: grid; place-items: center; padding: 24px; background: rgba(11, 16, 34, 0.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity 0.15s ease-out; }
.nc-drop[hidden] { display: none; }
@starting-style { .nc-drop:not([hidden]) { opacity: 0; } }
.nc-drop-box { display: grid; justify-items: center; gap: 8px; width: min(560px, 100%); padding: 48px 24px; border: 2px dashed rgba(61, 220, 151, 0.6); border-radius: 24px; background: var(--surface); text-align: center; pointer-events: none; }
.nc-drop-box svg { width: 40px; height: 40px; fill: var(--accent); transform: scaleX(-1); }
.nc-drop-box b { font-size: var(--fs-sub); }
.nc-drop-box span { color: var(--text-2); font-size: var(--fs-small); }
@media (prefers-reduced-motion: reduce) {
  .nc-attach-menu, .nc-send, .nc-drop { transition: none; }
  .nc-composer.is-empty .nc-send, .nc-composer.is-empty .nc-send:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) { .nc-drop { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* =================================================================
   30 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 8.4): «ناقصنا منك» والعرض والمراحل
   1) بند «ناقصنا منك» بدائرة كتطبيق التذكيرات بدل المربع، وتمتلئ بالنعناع مع ✓ حين يكتمل (المربع الأصلي نفسه بمظهر جديد، فيبقى للوحة المفاتيح وقارئ الشاشة)
   2) شارة «باقي N يوم» في رأس العرض (بلون أدفأ في آخر 3 أيام)، وزرا العرض بعرض البطاقة على الجوال
   3) «ناقصنا منك» في سطر الشريط المطوي شارة ملوّنة بعددها
   ================================================================= */
.nc-check { align-items: center; gap: 12px; min-height: 48px; }
.nc-check input { -webkit-appearance: none; appearance: none; display: grid; place-items: center; width: 24px; height: 24px; margin: 0; border: 2px solid rgba(170, 185, 255, 0.5); border-radius: 50%; background: transparent; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.nc-check input::after { content: ""; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg) scale(0); transition: transform 0.18s cubic-bezier(0.23, 1, 0.32, 1); }
.nc-check input:checked { border-color: var(--accent); background: var(--accent); }
.nc-check input:checked::after { transform: translateY(-1px) rotate(45deg) scale(1); }
.nc-check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nc-check input:disabled { opacity: 0.6; cursor: default; }
@media (hover: hover) { .nc-check:hover input:not(:checked):not(:disabled) { border-color: var(--accent); } }
.nc-quote h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.nc-quote-left { margin-inline-start: auto; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--text); font-size: 0.8125rem; font-weight: 500; line-height: 1.6; }
.nc-quote-left.is-soon { background: rgba(255, 196, 107, 0.14); color: #FFD18A; }
@media (max-width: 560px) { .nc-quote-acts .btn { flex: 1 1 100%; min-height: 48px; } }
.nc-proj-badge { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 8px; padding-block: 1px; padding-inline: 10px 3px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--text); font-weight: 500; white-space: nowrap; }
.nc-proj-badge b { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 0.75rem; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .nc-check input, .nc-check input::after { transition: none; } }

/* =================================================================
   30 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 8.5): «ملفات المشروع»
   1) شبكة كتطبيق الصور: الصورة مربعة 1:1، والمستند مربع بحجمها، واسم الملف سطر واحد (كاملًا في title ولقارئ الشاشة)
   2) لون مربع الامتداد حسب النوع، في الشبكة وفي الخيط (فاتح على خلفية ملوّنة خافتة، والتباين فوق 4.5:1)
   3) الحالة الفارغة بأيقونة وزر «أرسل ملفًا»
   ================================================================= */
.nc-files-grid .nc-file { gap: 10px; padding: 8px; border-radius: 16px; }
.nc-files-grid .nc-thumb { aspect-ratio: 1; border-radius: 10px; }
.nc-files-grid .nc-file-tile { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; font-size: 1.125rem; letter-spacing: 0.06em; }
.nc-files-grid .nc-file-info { padding-inline: 4px; }
.nc-files-grid .nc-file-info b { overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; white-space: nowrap; }
.nc-files-grid .nc-file-acts { padding-inline: 4px; }
.nc-file-ext[data-kind="pdf"] { background: rgba(255, 120, 110, 0.16); color: #FFA49B; }
.nc-file-ext[data-kind="doc"] { background: rgba(110, 150, 255, 0.16); color: #B4C6FF; }
.nc-file-ext[data-kind="xls"] { background: rgba(61, 220, 151, 0.14); color: #7DEBB8; }
.nc-file-ext[data-kind="zip"] { background: rgba(255, 196, 107, 0.16); color: #FFD18A; }
.nc-file-ext[data-kind="design"] { background: rgba(200, 140, 255, 0.16); color: #DCC0FF; }
.nc-files-empty .nc-empty-ic svg { width: 28px; height: 28px; fill: currentColor; }
.nc-files-empty p { text-wrap: balance; }

/* =================================================================
   30 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 8.6): الإشعارات
   1) بطاقة التنبيه بأيقونة جرس في مربع ملوّن كطلب الإذن في iOS (جرس يرن حين تكون مفعّلة، وعلامة معلومة حين تكون محجوبة)
   2) نقطة خضراء على جرس الرأس حين تكون التنبيهات مفعّلة، فلا يعتمد على اللون وحده
   3) تعليمات الآيفون خطوات مرقّمة
   ================================================================= */
.nc-note[data-state] { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 10px 14px; }
.nc-note[data-state][hidden] { display: none; }
.nc-push-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.nc-push-ic svg { width: 22px; height: 22px; fill: currentColor; }
.nc-note[data-state="denied"] .nc-push-ic { background: var(--surface-2); color: var(--text-2); }
.nc-push-body { min-width: 0; color: var(--text); }
.nc-push-body p { color: inherit; }
.nc-push-steps { margin: 6px 0 0; padding-inline-start: 22px; display: grid; gap: 2px; color: var(--text-2); }
.nc-push-steps li::marker { color: var(--accent); font-weight: 700; }
.nc-note[data-state="ios"] { align-items: start; }
.nc-note[data-state="ios"] > .nc-link { align-self: center; }
@media (max-width: 560px) {
  .nc-note[data-state] { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .nc-push-body { grid-column: 2 / -1; }
  .nc-note[data-state] > .btn { grid-column: 2; justify-self: start; }
  .nc-note[data-state] > .nc-link { grid-column: 3; }
  .nc-note[data-state] > .nc-push-body + .nc-link { grid-column: 2; justify-self: start; } /* بلا زر (الآيفون، المحجوبة): «لاحقًا» تحت النص */
}
.nc-bell { position: relative; }
.nc-bell.is-on::after { content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }


/* =================================================================
   31 أكتوبر (خطة-التطوير-حبة-حبة.md، الجزء 14.1): قائمة المحادثات والفرز
   لوح «اختر محادثة» على الكمبيوتر، والحرف الأول للاسم، ورمز الطلب، والانتظار شارة بأيقونة، و«مسودة»،
   وبطاقات أضغط على الجوال، وزر مسح البحث، والتطابق مظلّل
   ================================================================= */
.team-pick { grid-column: 2 / -1; align-self: start; display: grid; justify-items: center; gap: 8px; margin-top: 48px; padding: 32px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-card); color: var(--text-2); text-align: center; }
.team-pick[hidden] { display: none; }
.team-pick b { color: var(--text); font-size: var(--fs-sub); }
.team-pick p { margin: 0; font-size: var(--fs-small); line-height: 1.8; }
.team-pick-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.team-pick-ic [data-icon], .team-pick-ic svg { width: 28px; height: 28px; fill: currentColor; }
.team-pick-keys { color: var(--text-3); }
@media (max-width: 860px) { .team-pick { display: none !important; } }
.team-search { display: flex; align-items: center; }
.team-search .input { padding-inline-end: 48px; }
.team-q-x { position: absolute; inset-inline-end: 6px; width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-2); }
.team-q-x svg { width: 16px; height: 16px; }
.team-q-x[hidden] { display: none; }
#team-q::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; } /* زر المسح الأصلي في المتصفح: يكفي زرنا */
.team-item { grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center; transition: border-color 0.15s, background-color 0.15s, scale 0.1s ease-out; }
.team-item > :not(.team-av) { grid-column: 2; min-width: 0; }
.team-av { grid-row: 1 / span 4; align-self: start; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: 1.05rem; }
.team-item[aria-current="true"] .team-av { background: var(--accent); color: var(--on-accent); }
.team-item:active { scale: 0.985; }
@media (hover: hover) { .team-item:hover { background: var(--surface-2); } }
.team-item mark { background: rgba(61, 220, 151, 0.25); color: inherit; border-radius: 3px; padding: 0 1px; }
.team-item-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.team-wait { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-pill); background: rgba(255, 196, 107, 0.14); color: #FFD18A !important; font-weight: 600; }
.team-wait svg { width: 13px; height: 13px; fill: currentColor; flex: none; }
.team-wait.is-late { background: rgba(255, 138, 128, 0.16); color: var(--danger) !important; }
.team-item-code { padding: 0 6px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 0.75rem; }
.team-item-draft { padding: 0 8px; border-radius: var(--radius-pill); border: 1px dashed var(--line-strong); color: var(--text-2); font-size: 0.75rem; }
@media (max-width: 860px) {
  .team-item { padding: 10px 12px; }
  .team-item-last { display: block; }
}
@media (prefers-reduced-motion: reduce) { .team-item:active { scale: none; } }


/* =================================================================
   31 أكتوبر (الجزء 14.2): المحادثة والملاحظات و«نبّهه»
   الحرف الأول للعميل بجانب آخر فقاعة من رسائله، ورموز الطلب وشارة الانتظار في الرأس،
   ونص رسالة واتساب ظاهر في شريط «نبّهه»، وسطر مفاتيح الردود الجاهزة
   ================================================================= */
[data-chat="team"] .nc-msg--them[data-av] { padding-inline-start: 38px; max-width: min(calc(82% + 38px), 598px); }
[data-chat="team"] .nc-msg--them[data-av].nc-run-end::before { content: attr(data-av); position: absolute; inset-inline-start: 0; bottom: 28px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--accent); font-size: 0.9rem; font-weight: 700; }
.team-head-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.team-head-tags:empty { display: none; }
.team-head-tags .team-wait { font-size: var(--fs-small); }
.team-nudge-msg { display: block; margin-top: 4px; color: var(--text-3); font-size: 0.8125rem; line-height: 1.6; overflow-wrap: anywhere; }
.team-nudge-was { display: block; margin-top: 2px; color: #FFD18A; font-size: 0.8125rem; }
.team-nudge-was[hidden] { display: none; }
.nc-qr-hint { padding: 6px 12px 2px !important; color: var(--text-3); font-size: 0.75rem; cursor: default !important; background: none !important; border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 !important; }
#note-text { resize: none; overflow-y: auto; max-height: 40vh; }


/* =================================================================
   31 أكتوبر (الجزء 14.3): بطاقة العميل والتفاصيل
   الاسم والرقم مع «نسخ» و«عميل منذ»، والتنبيهات شارة بنقطة، وطلباته برموز تُنسخ، والأدوات صفوف بأيقونات وسهم
   ================================================================= */
.team-card-id { display: flex; align-items: center; gap: 12px; }
.team-av--lg { width: 48px; height: 48px; font-size: 1.25rem; flex: none; }
.team-card-id > div { display: grid; gap: 2px; min-width: 0; }
.team-card-id b { font-size: var(--fs-body); overflow-wrap: anywhere; }
.team-card-phone { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-small); }
.team-card-id small { color: var(--text-3); font-size: 0.8125rem; }
.team-copy { min-height: 32px; padding: 2px 4px; font-size: var(--fs-small); }
.team-copy.is-copied { color: var(--accent); text-decoration: none; }
.team-push-chip { display: inline-flex; align-items: center; gap: 8px; justify-self: start; margin: 0; padding: 3px 12px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-small); }
.team-push-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.team-push-chip.is-on { background: var(--accent-soft); color: var(--text); }
.team-push-chip.is-on::before { background: var(--accent); }
.team-push-chip:empty { display: none; }
.team-reqs { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.team-reqs[hidden] { display: none; }
.team-reqs h3 { margin: 0; font-size: var(--fs-small); color: var(--text-2); font-weight: 600; }
.team-reqs ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.team-reqs li { display: flex; align-items: flex-start; gap: 10px; }
.team-req-code { flex: none; min-height: 32px; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; }
.team-req-code.is-copied { border-color: var(--accent); }
.team-req-info { display: grid; gap: 1px; min-width: 0; }
.team-req-info b { font-size: var(--fs-small); font-weight: 600; }
.team-req-info small { color: var(--text-3); font-size: 0.8125rem; line-height: 1.6; }
.team-tools summary { list-style: none; display: flex; align-items: center; gap: 10px; }
.team-tools summary::-webkit-details-marker { display: none; }
.team-tools summary::after { content: ""; width: 7px; height: 7px; margin-inline-start: auto; border: solid var(--text-2); border-width: 0 0 2px 2px; transform: rotate(45deg); transition: transform 0.2s ease-out; }
.team-tools details[open] > summary::after { transform: rotate(-45deg); }
.tool-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tool-ic [data-icon], .tool-ic svg { width: 17px; height: 17px; fill: currentColor; }
@media (max-width: 1199px) { .team-details { transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1); } .team-details-head { touch-action: pan-y; } }
@media (prefers-reduced-motion: reduce) { .team-tools summary::after, .team-details { transition: none; } }

/* الجزء 14.4 «الأرقام»: شريط المدة مع «حدّث» و«انسخ الملخص»، والفرق عن المدة السابقة، وأكبر تسرّب، وأيام تحت الأشرطة، والروابط المفقودة */
.tn-bar-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.tn-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tn-at { color: var(--text-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.tn-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--text); font: inherit; font-size: var(--fs-small); cursor: pointer; transition: transform 0.12s, opacity 0.12s; }
.tn-tool svg { width: 16px; height: 16px; color: var(--text-2); }
.tn-tool:active { transform: scale(0.97); }
.tn-tool:disabled { opacity: 0.5; cursor: default; }
.tn-d { color: var(--text-3); font-size: 0.8125rem; line-height: 1.6; }
.tn-d--up { color: var(--accent); }
.tn-d--down { color: #F2B36B; }
.tn-insight { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: var(--fs-small); line-height: 1.7; }
.tn-insight > i { flex: none; display: inline-flex; margin-top: 3px; color: var(--accent); }
.tn-insight svg { width: 18px; height: 18px; }
.tn-days-x { display: flex; gap: 2px; margin-top: -4px; }
.tn-dx { flex: 1 1 0; min-width: 0; overflow: visible; color: var(--text-3); font-size: 0.75rem; line-height: 1.4; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tn-dx:first-child { text-align: start; }
.tn-dx:last-child { color: var(--text-2); text-align: end; }
.tn-miss { max-width: 34rem; }
.tn-miss li { grid-template-columns: minmax(0, 1fr) 3rem; }
.tn-miss .tn-l { text-align: right; unicode-bidi: plaintext; font-family: ui-monospace, Consolas, monospace; font-size: 0.8125rem; }
@media (max-width: 599px) {
  .tn-bar-top { align-items: stretch; }
  .tn-tools { width: 100%; }
  .tn-at { flex-basis: 100%; }
  .tn-tool { flex: 1 1 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .tn-tool { transition: none; } }

/* Paymob: two instalments in the accepted quote, using the existing quote type and buttons. */
.nc-payment { margin-block-start: 1rem; padding-block-start: 1rem; border-block-start: 1px solid var(--line); }
.nc-payment h4 { margin-block: 0 0.75rem; font-size: 0.875rem; }
.nc-payment-due { display: grid; gap: 0.35rem; padding-block: 0.75rem; }
.nc-payment-due + .nc-payment-due { border-block-start: 1px solid var(--line); }
.nc-payment-due p { margin: 0; }
.nc-payment-due .btn { justify-self: start; max-width: 100%; white-space: normal; }
.nc-payment-due small { color: var(--text-2); overflow-wrap: anywhere; }

/* v61 (4 نوفمبر، مهارتا form-design وapple-design): لوح الدفع فوق المحادثة.
   على الكمبيوتر لوح في الوسط يكبر قليلًا عند الفتح، وعلى الجوال لوح من الأسفل بمقبض يُسحب للأسفل ليُغلق.
   المبلغ عنوان اللوح بخط العناوين، والزر الوحيد الملوّن هو زر الدفع داخل خانات Paymob */
.nc-pay { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); margin: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface); color: var(--text); overflow: auto; overscroll-behavior: contain; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
.nc-pay::backdrop { background: rgba(5, 8, 18, 0.66); -webkit-backdrop-filter: blur(10px) saturate(120%); backdrop-filter: blur(10px) saturate(120%); }
.nc-pay[open] { animation: nc-pay-in 0.32s cubic-bezier(0.32, 0.72, 0, 1); }
.nc-pay[open]::backdrop { animation: nc-pay-dim 0.32s ease-out; }
.nc-pay.is-closing { animation: nc-pay-out 0.18s ease-in forwards; }
.nc-pay.is-closing::backdrop { animation: nc-pay-undim 0.18s ease-in forwards; }
.nc-pay-grab { display: none; }
.nc-pay-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 22px 16px; background: var(--surface); }
.nc-pay-amount { margin: 0; font-family: var(--font-display); font-size: 2rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.nc-pay-cur { margin-inline-start: 2px; font-family: var(--font-body); font-size: 1rem; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.nc-pay-what { margin: 6px 0 0; color: var(--text-2); font-size: var(--fs-small); }
.nc-pay-what .nc-code { color: var(--text); }
.nc-pay-x { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; margin: -2px -4px 0 0; padding: 0; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: background-color 0.15s, color 0.15s, transform 0.1s ease-out; }
.nc-pay-x svg { width: 18px; height: 18px; fill: currentColor; }
.nc-pay-x:hover { background: #222C52; color: var(--text); }
.nc-pay-x:active { transform: scale(0.92); }
.nc-pay-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nc-pay-body { position: relative; }
.nc-pay-frame { display: block; width: 100%; height: 330px; border: 0; background: var(--surface); color-scheme: dark; transition: height 0.25s cubic-bezier(0.32, 0.72, 0, 1); }
.nc-pay-foot { display: grid; justify-items: center; gap: 4px; padding: 4px 22px 20px; text-align: center; }
.nc-pay-safe { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text-2); font-size: var(--fs-small); }
.nc-pay-safe svg { flex: none; width: 16px; height: 16px; fill: var(--accent); }
.nc-pay-full { display: inline-flex; align-items: center; min-height: 32px; color: var(--text-3); font-size: 0.8125rem; text-decoration: underline; text-decoration-color: rgba(141, 149, 179, 0.45); text-underline-offset: 3px; }
.nc-pay-full:hover { color: var(--text-2); }

/* شاشات بعد الدفع داخل اللوح: نتحقق، وصلت دفعتك، لم تكتمل */
.nc-pay-state { display: grid; justify-items: center; gap: 6px; padding: 18px 26px 28px; text-align: center; animation: nc-pay-fade 0.25s ease-out; }
.nc-pay-state h3 { margin: 10px 0 2px; font-size: var(--fs-sub); font-weight: 700; outline: none; }
.nc-pay-state p { margin: 0; color: var(--text-2); font-size: var(--fs-small); line-height: 1.8; max-width: 32ch; }
.nc-pay-actions { display: grid; gap: 10px; width: 100%; margin-top: 18px; }
.nc-pay-actions .btn { width: 100%; min-height: 50px; }
.nc-pay-mark { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; }
.nc-pay-mark svg { width: 32px; height: 32px; fill: currentColor; }
.nc-pay-mark-ok { background: var(--accent-soft); color: var(--accent); animation: nc-pay-pop 0.45s cubic-bezier(0.34, 1.4, 0.64, 1); }
.nc-pay-mark-fail { background: rgba(255, 138, 128, 0.12); color: var(--danger); }
.nc-pay-mark-wait { position: relative; background: var(--surface-2); }
.nc-pay-mark-wait::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; border: 3px solid rgba(61, 220, 151, 0.18); border-top-color: var(--accent); animation: nc-pay-spin 0.9s linear infinite; }
html.nc-pay-open { overflow: hidden; }

@keyframes nc-pay-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes nc-pay-out { to { opacity: 0; transform: scale(0.97); } }
@keyframes nc-pay-dim { from { opacity: 0; } }
@keyframes nc-pay-undim { to { opacity: 0; } }
@keyframes nc-pay-fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes nc-pay-pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes nc-pay-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .nc-pay { width: 100%; max-width: 100%; max-height: 94dvh; margin: auto 0 0; border: 0; border-top: 1px solid var(--line-strong); border-radius: 26px 26px 0 0; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, 0.7); }
  .nc-pay[open] { animation: nc-pay-up 0.42s cubic-bezier(0.32, 0.72, 0, 1); }
  .nc-pay.is-closing { animation: nc-pay-down 0.28s cubic-bezier(0.32, 0.72, 0, 1) forwards; }
  .nc-pay-grab { display: grid; place-items: center; height: 22px; touch-action: none; cursor: grab; }
  .nc-pay-handle { width: 38px; height: 5px; border-radius: 3px; background: #3A4266; }
  .nc-pay-head { padding: 4px 20px 14px; touch-action: none; }
  .nc-pay-amount { font-size: 1.875rem; }
  .nc-pay-foot { padding-bottom: 18px; }
  @keyframes nc-pay-up { from { transform: translateY(100%); } to { transform: none; } }
  @keyframes nc-pay-down { to { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) {
  .nc-pay[open], .nc-pay.is-closing, .nc-pay-state, .nc-pay-mark-ok { animation-name: nc-pay-dim; animation-duration: 0.16s; animation-timing-function: ease; }
  .nc-pay.is-closing { animation-name: nc-pay-undim; }
  .nc-pay-mark-wait::before { animation-duration: 2.4s; }
  .nc-pay-frame { transition: none; }
}
@media (prefers-reduced-transparency: reduce) { .nc-pay::backdrop { background: rgba(5, 8, 18, 0.9); backdrop-filter: none; -webkit-backdrop-filter: none; } }

/* v64: زر Apple Pay الرسمي أول اللوح على أجهزة أبل (أبيض على الخلفية الداكنة، كما توصي أبل)، ثم «أو ادفع بالبطاقة» */
.nc-pay-ap { padding: 2px 20px 0; }
.nc-pay-apple { display: block; width: 100%; height: 52px; margin: 0; padding: 0; border: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: #fff; -webkit-appearance: -apple-pay-button; -apple-pay-button-type: pay; -apple-pay-button-style: white; }
.nc-pay-apple:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nc-pay-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 2px; color: var(--text-3); font-size: var(--fs-small); }
.nc-pay-or::before, .nc-pay-or::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.nc-ap-mark { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: #fff; color: #000; font: 500 12px/1 -apple-system, system-ui, sans-serif; direction: ltr; }
/* v65: علامات البطاقات المقبولة تحت زر «ادفع» في بطاقة العرض */
.nc-pay-accept { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; }
.nc-pay-chip { display: grid; place-items: center; width: 42px; height: 26px; border-radius: 5px; background: #fff; }
.nc-pay-chip img { display: block; width: auto; max-width: 32px; height: auto; max-height: 15px; }
.nc-pay-accept .nc-ap-mark { height: 26px; padding: 0 8px; font-size: 13px; }
