/* s8_account.css — حزمة S8 (الحساب · الفريق · الاشتراك · المحادثة · الطوارئ · المساعد)، 2026-11-14.
 * اتجاه «دفتر القيادة»: جواب ثم إجراء ثم سياق ثم سجل. رموز system.css وحدها (بلا ألوان حرفية).
 * يُحمَّل من ensureS8Css() في profile.js إلى أن يضيفه الغلاف إلى index.html وSHELL_ASSETS. */

.s8-page { display: flex; flex-direction: column; gap: var(--sp-4); padding-block: var(--sp-3); }
.s8-page > .ux { display: block; }
.s8-hint { font-size: var(--fs-label); }

/* ───── الحساب: بطاقة الهوية ثم مجموعات صفوف مرتبة ───── */
html .account-hub .account-profile-hero {
  display: flex; align-items: center; gap: var(--sp-3); padding: 14px 16px; margin: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none; color: var(--ink);
}
html .account-hub .account-profile-hero h1 { color: var(--ink); font-size: var(--fs-md); margin: 0; }
html .account-hub .account-profile-hero small,
html .account-hub .account-profile-hero .account-farm-name { color: var(--muted); border: 0; }
html .account-hub .account-profile-hero .account-farm-name strong { color: var(--ink); }
html .account-hub .account-profile-hero .section-kicker { color: var(--muted); font-size: var(--fs-label); }
html .account-hub .account-profile-hero .account-farm-name { margin-inline-start: auto; text-align: end; padding: 0; }
html .account-hub .account-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; color: var(--muted); font-size: var(--fs-label); }
html .account-hub .account-role-badge { color: var(--accent-ink); }
html .account-hub .account-groups { display: flex; flex-direction: column; gap: var(--sp-4); margin: 0; }
html .account-hub .account-group { display: flex; flex-direction: column; gap: var(--sp-2); }
html .account-hub .account-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
html .account-hub .account-group-heading h2 { font-size: var(--fs-md); margin: 0; }
html .account-hub .account-group-heading .section-kicker { color: var(--muted); font-size: var(--fs-label); order: 2; }
html .account-hub .account-action-grid {
  display: flex; flex-direction: column; gap: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: none;
}
html .account-hub .disclosure-item.info-account { border-top: 1px solid var(--line-soft); }
html .account-hub .disclosure-item.info-account:first-child, html .account-hub .account-action-grid > :first-child { border-top: 0; }
html .account-hub .account-action-card {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 60px; width: 100%; padding: 8px 14px;
  background: transparent; border: 0; border-radius: 0; box-shadow: none; color: var(--ink); text-align: start;
}
html .account-hub .account-action-card:hover { background: var(--surface-2); transform: none; }
html .account-hub .account-action-icon {
  width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--muted); background-image: none;
}
html .account-hub .account-action-copy { flex: 1; min-width: 0; }
html .account-hub .account-action-copy strong { font-size: var(--fs-body); font-weight: 600; }
html .account-hub .hub-arrow { color: var(--muted); }
.s8-theme { padding: 14px 16px; display: flex; flex-direction: column; gap: var(--sp-3); }
.s8-theme h3 { font-size: var(--fs-md); }
.s8-logout {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--touch); width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); font-weight: 600; cursor: pointer;
}
.s8-logout svg { width: 20px; height: 20px; fill: none; stroke: var(--danger); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ───── إعدادات الحساب: عنوان الصفحة وبطاقة الملف ───── */
.settings-workspace.s8-page .settings-page-intro h1 { font-size: var(--fs-lg); }
.settings-workspace.s8-page .settings-page-intro .section-kicker { color: var(--muted); font-size: var(--fs-label); }

/* ───── الفريق ───── */
.s8-page .team-member-row {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 60px; padding: 8px 4px;
  border-top: 1px solid var(--line-soft);
}
.s8-page .team-member-row:first-of-type { border-top: 0; }
.s8-page .team-member-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s8-page .team-member-copy small { color: var(--muted); font-size: var(--fs-label); }
.s8-link-row {
  display: flex; align-items: center; justify-content: space-between; min-height: var(--touch); padding: 0 var(--sp-2);
  background: none; border: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer;
}
/* صلاحيات: مفاتيح تبديل بدل مربعات اختيار (العنصر نفسه checkbox بسلوكه وإتاحته) */
.record-sheet .perm-grid { display: flex; flex-direction: column; gap: 0; }
.record-sheet .perm-grid > label {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: var(--touch);
  border-top: 1px solid var(--line-soft); cursor: pointer;
}
.record-sheet .perm-grid > label:first-child { border-top: 0; }
.record-sheet .perm-grid input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; order: 2; flex: none; position: relative; width: 52px; height: 30px; margin: 0;
  border-radius: 15px; background: var(--track); border: 1px solid var(--line); cursor: pointer; transition: background .15s;
}
.record-sheet .perm-grid input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--muted); transition: inset-inline-start .15s, background .15s;
}
.record-sheet .perm-grid input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.record-sheet .perm-grid input[type="checkbox"]:checked::after { inset-inline-start: 25px; background: var(--on-primary); }
.record-sheet .perm-grid input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.record-sheet .perm-section-title { color: var(--muted); font-size: var(--fs-label); font-weight: 500; margin: var(--sp-3) 0 var(--sp-1); }
.s8-perm-note { color: var(--muted); font-size: var(--fs-label); }
@media (prefers-reduced-motion: reduce) {
  .record-sheet .perm-grid input[type="checkbox"], .record-sheet .perm-grid input[type="checkbox"]::after { transition: none; }
}

/* ───── الاشتراك ───── */
.s8-usage { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.s8-usage:first-of-type { border-top: 0; }
.s8-usage-text { font-size: var(--fs-body); }
.s8-page .usage-bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.s8-page .usage-fill { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.s8-page .usage-fill.warn { background: var(--warn); }

/* ───── المحادثة والمساعد والطوارئ: رموز النظام وأسطح موحدة ───── */
.assistant-panel .assistant-msg { border-radius: var(--r-md); }
.emergency-alert, .intercom-banner, .intercom-talk-bar, .sos-voice-bar {
  border-radius: var(--r-lg); border: 1px solid var(--line);
}
.emergency-alert strong svg, .sos-voice-bar svg, .intercom-banner svg, .intercom-talk-bar svg,
.emergency-alert button svg, .sos-unlock svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle; flex: none;
}

/* ───── الطوارئ (m-sos / m-sos-worker): بطاقة وسطية ثابتة لا مرتكزة في ركن ───── */
html .emergency-alert {
  /* وسط الشاشة بحافة علوية ثابتة (لا translateY(-50%)): إخفاء زر تفعيل الصوت عند أول لمسة يقصّر البطاقة فلا يزحزح زر «استلمت» تحت المؤشر */
  inset: auto; top: max(72px, calc(50dvh - 190px)); left: 50%; transform: translateX(-50%);
  width: min(92vw, 440px); max-height: 80vh; padding: var(--sp-5, 20px);
  border: 1px solid var(--danger); border-radius: var(--r-lg);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
html .emergency-alert[hidden] { display: none; }
html .emergency-alert > div { display: flex; flex-direction: column; gap: var(--sp-2); }
html .emergency-alert > div + div { border-top: 1px solid var(--line-soft); padding-top: var(--sp-3); }
html .emergency-alert strong { display: flex; align-items: center; gap: var(--sp-2); color: var(--danger); font-size: var(--fs-md); }
html .emergency-alert p { margin: 0; color: var(--ink); }
html .emergency-alert button { min-height: var(--touch); margin-top: 0; width: 100%; }
html .emergency-alert .emergency-voice { flex-direction: row; flex-wrap: wrap; gap: var(--sp-2); }
html .emergency-alert .emergency-voice button { width: auto; flex: 1; }
.s8-select {
  width: 100%; min-height: var(--touch); padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: inherit;
}

/* ───── المحادثة (m-chat): تبويبات بخط سفلي وعدّاد، وجملة الحالة ───── */
.s8-chat .chat-sidebar > .ux { padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.s8-chat .chat-segmented { gap: 0; padding: 0 var(--sp-2); border-bottom: 1px solid var(--line); }
.s8-chat .chat-segmented button {
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted);
  padding: 8px 10px; min-height: var(--touch);
}
.s8-chat .chat-segmented button.on { background: none; color: var(--ink); border-bottom-color: var(--accent-ink); }
.s8-chat .chat-segmented .chat-tab-count {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: var(--on-danger);
  font-size: var(--fs-label); font-weight: 700; line-height: 20px; direction: ltr;
}

/* ───── المساعد داخل نافذة المكتبة ───── */
.s8-assistant { display: flex; flex-direction: column; gap: var(--sp-3); }
.ux .s8-assistant .assistant-send { min-width: var(--touch); min-height: var(--touch); border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); display: inline-grid; place-items: center; }
.ux .s8-assistant .assistant-send[disabled] { opacity: .5; }
.ux .s8-assistant .assistant-input { flex: 1; min-width: 0; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; font: inherit; }
.ux .s8-assistant .assistant-compose { display: flex; gap: var(--sp-2); align-items: stretch; }
.ux .s8-assistant .assistant-clear { color: var(--accent-ink); text-align: start; min-height: var(--touch); }

/* ───── الاشتراك: الأقسام السفلى بقواعد الدفتر ───── */
.s8-page .s8-input {
  width: 100%; min-height: var(--touch); padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: inherit;
}
.s8-page .s8-input:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
.s8-coupon { display: flex; gap: var(--sp-2); align-items: stretch; }
.s8-coupon .s8-input { flex: 1; min-width: 0; }
.s8-page .s8-row-btn { width: auto; min-height: var(--touch); white-space: nowrap; margin: 0; }
.s8-plan { display: flex; flex-direction: column; gap: var(--sp-2); }
.s8-plan .s8-plan-price { font-family: var(--font-display); font-size: var(--fs-md); color: var(--ink); direction: rtl; }
.s8-plan .care-list { display: flex; flex-direction: column; gap: 4px; padding: 0; list-style: none; color: var(--muted); font-size: var(--fs-label); }
.s8-page .plan-current { border-color: var(--accent-ink); background: var(--surface-2); }
.s8-compare { overflow-x: auto; }
.s8-compare table { width: 100%; border-collapse: collapse; font-size: var(--fs-label); }
.s8-compare th, .s8-compare td { padding: 10px 8px; border-top: 1px solid var(--line-soft); text-align: start; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.s8-compare thead th { border-top: 0; color: var(--muted); font-weight: 500; }
.s8-page .faq-item { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.s8-page .faq-item:first-of-type { border-top: 0; }

/* FX1 (V16): صورة المستخدم الافتراضية (مزارع) في أي موضع تعرض فيه الصورة الشخصية */
.profile-avatar.is-default { background: transparent; overflow: hidden; border-radius: 50%; padding: 0; }
.profile-avatar.is-default img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* FX1 (V16): رابط واحد بنمط المكتبة (.ux .link) لروابط «معلومات التطبيق» */
.info-link, .info-link:visited { color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; font-size: var(--fs-label); }
.info-link:hover { text-decoration: underline; text-underline-offset: 3px; }
p:has(> .info-link) { margin: 0; }
