/* مراح ذكي — نظام التصميم.
 *
 * ثلاثة مبادئ حاكمة:
 *   الجوال أولاً   الاستعمال في الحظيرة لا على مكتب
 *   حدود لا ظلال   الظل يُحسب في كل إطار على أجهزة اقتصادية
 *   لا لون وحده    الشمس تغسل الألوان، فالإشارة والسهم يحملان المعنى
 */

:root {
  --topbar-height: 70px;
  --radius: 12px;
  --radius-sm: 9px;
  --bar: 62px;          /* ارتفاع الشريط السفلي */
}

* { box-sizing: border-box; }

/* عناصر المتصفح الأصلية (منتقي التاريخ/الوقت، شريط التمرير) تتبع نفس
   السمة — بدونها يظهر منتقي التاريخ والوقت أبيض فاقعاً داخل نموذج داكن
   (شكوى مالك حقيقية على شاشة إنشاء عرض حراج). */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* الإخفاء يتقدّم على أي عرض: قاعدة المتصفح [hidden] أولويتها (0-1-0)
   وأي قاعدة بمعرّف تغلبها، فيبقى العنصر ظاهراً رغم hidden=true */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma,
               "Noto Naskh Arabic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  /* لمسة الإصبع لا تنتظر 300ms قبل أن تُنفَّذ، ولا تُقرأ كبداية
     تكبير مزدوج — الاستعمال الميداني بالأصابع سريع ومتكرر، وكل
     مكوّن هنا يملك أصلاً حالة ضغط بصرية خاصة به (:active/:focus-visible
     في كل زر بهذا الملف)، فلا حاجة لوميض التظليل الافتراضي فوقها. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.screen { min-height: 100vh; }

/* ── شاشة التمهيد ── */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--boot-bg, var(--bg)); /* --boot-bg من ui-boot.js: لون الصفحة المنتظرة */
  transition: opacity .28s ease;
}
.boot-splash.is-leaving { opacity: 0; pointer-events: none; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ── الدخول ── */
#login { display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-card .brand svg { flex: 0 0 auto; }
.login-card h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }

/* ── بطاقة طبية عامة (رابط مشاركة، بلا جلسة) ── */
.public-passport {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px 48px;
  min-height: 100vh;
  background: var(--bg);
}
.public-passport > * { width: min(560px, 100%); }

/* ── الشريط العلوي ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.who .brand-mark { flex: 0 0 auto; }
.who-text { min-width: 0; }
.who strong { display: block; font-size: 1rem; }
.topbar .muted { display: block; font-size: .82rem; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.bell, .icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}

/* العدد يحمل المعنى لا اللون وحده — أحمر للحرج، محايد لغير الحرج */
.bell .badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--primary-ink);
  font-size: .68rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.chat-button .chat-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 17px;
  height: 17px;
  margin: 0;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: .68rem;
  line-height: 17px;
  text-align: center;
}

.bell .badge.critical { background: var(--danger); }

/* ── تبويبات الحاسوب ── */
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.tabs button {
  flex: 0 0 auto;
  min-height: 44px;   /* DP-28 (T-61): هدف 44 */
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
}

.tabs button:is([aria-selected="true"], [aria-current="page"]) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--ink);
  font-weight: 700;
}

main {
  padding: 16px;
  max-width: 1000px;
  margin: 0 auto;
  /* مساحة للشريط السفلي والزر العائم فلا يغطّيان آخر بطاقة */
  padding-bottom: calc(var(--bar) + 28px + env(safe-area-inset-bottom));
}

/* ── الشريط السفلي والزر العائم: الجوال ── */
.bottombar, .fab { display: none; }

@media (max-width: 860px) {
  .tabs { display: none; }

  .bottombar {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    /* عدد الأعمدة يتبع عدد التبويبات الفعلي (يختلف بصلاحيات
       المستخدم) — يُضبط من JS عند كل رسم، وهذا احتياطي فقط */
    grid-template-columns: repeat(7, 1fr);
    align-items: stretch;
    height: calc(var(--bar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }

  .bottombar button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-top: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: .68rem;
    cursor: pointer;
    padding: 6px 2px;
    min-width: 0;
  }

  .bottombar button span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .bottombar button svg { width: 22px; height: 22px; }

  /* الشارة داخل الشريط السفلي: نقطة مطلقة على زاوية الأيقونة، لا
     عنصر flex عادي يضيف صفاً ثالثاً تحت التسمية (كان يُمدّد الزر
     رأسياً ويتداخل بصرياً مع الزر العائم المجاور عبر margin-inline-start
     القديم) — نفس نمط شارة أيقونة الجرس تماماً (`.bell .badge`). */
  .bottombar button .chat-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: calc(50% - 20px);
    margin-inline-start: 0;
    min-width: 16px;
    height: 16px;
    font-size: .62rem;
  }
  /* اللون وحده لا يكفي بالخارج تحت الشمس (مبدأ المشروع) — خط علوي
     وخلفية فاتحة يحملان الإشارة كمان، لا اللون فقط */
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) {
    color: var(--primary);
    font-weight: 700;
    border-top-color: var(--primary);
    background: var(--primary-soft);
  }

  /* الخانة الوسطى تُترك فارغة ليجلس فيها الزر العائم */
  .bottombar .slot { visibility: hidden; pointer-events: none; }

  .fab {
    position: fixed;
    z-index: 21;
    bottom: calc(var(--bar) - 26px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0;
    width: 62px;
    height: 62px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-ink);
    cursor: pointer;
  }

  .fab svg { width: 23px; height: 23px; }
  .fab span { font-size: .61rem; line-height: 1; }

  .fab:active { transform: translateX(-50%) scale(.94); }
  .fab:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
}

/* ── هيكل الجوال الجديد: عناوين سياقية، تنبيهات الصدارة، وأبواب
   الطبقة الثانية. حدود فقط بلا ظلال وفق مبادئ المشروع. ── */
.page-intro { margin: 2px 0 14px; }
.page-intro h1 { margin: 0; font-size: 1.35rem; }
.page-intro p { margin: 3px 0 0; }

/* ── واجهة الرئيسية: هوية بصرية واضحة بدلاً من عنوان نصّي عابر ── */.season-peek-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--k-season-peek-button-line);
  border-radius: 14px;
  background: var(--k-season-peek-button-bg);
  color: var(--c-white);
}
.season-peek-button:hover { background: var(--k-season-peek-button-bg-v2); }
.season-peek-button svg { width: 21px; height: 21px; }/* بطاقة واحدة في كل مرة: لمس وسحب أصليان، مع أسهم ونقاط كبديلين
   واضحين. اتجاه المسار LTR لتوحيد حساب scrollLeft بين المتصفحات،
   بينما محتوى كل بطاقة يبقى RTL. */.section-kicker {
  display: block;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .03em;
}
.metric-label { color: var(--muted); font-size: .9rem; font-weight: 650; }
.metric-value {
  margin-top: 12px;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -.035em;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}
.metric-value .delta { padding: 3px 10px; font-size: .72em; }/* ── مساحة القطيع: سياقات ثابتة وقائمة بطاقات بدلاً من جدول مكتبي ── */
.herd-page-intro { display: flex; align-items: flex-end; justify-content: space-between; }
.herd-page-intro h1 { font-size: 1.7rem; }
.herd-section-tabs {
  position: sticky;
  top: 69px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
}
.herd-section-tabs button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .86rem;
  font-weight: 650;
}
.herd-section-tabs button svg { width: 19px; height: 19px; }
.herd-section-tabs button[aria-selected="true"] {
  background: var(--primary);
  color: var(--primary-ink);
}
.herd-section-content { min-height: 280px; }
.herd-total-card {
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--line));
  border-radius: 22px;
  background: linear-gradient(145deg, var(--primary-soft), var(--surface));
}
.herd-total-card::after {
  content: '';
  position: absolute;
  width: 190px;
  height: 190px;
  inset-inline-end: -90px;
  top: -95px;
  border: 30px solid color-mix(in srgb, var(--primary) 8%, transparent);
  border-radius: 50%;
}
.herd-total-value {
  margin-top: 3px;
  font-size: clamp(2.7rem, 9vw, 4.3rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.055em;
}
.herd-total-card p { margin: 9px 0 0; color: var(--muted); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 1px 0 0; }

/* رأس بطاقة في الرئيسية: عنوان وفعل نصّي صغير على الطرف الآخر
   («الكل (4)»، «+ مهمة») — كانا بلا أي قاعدة فظهرا زرّين خامين. */
.dashboard-section-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.dashboard-section-heading h2 { margin: 0; }
.text-action {
  min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--primary);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer;
}
.text-action:hover { background: var(--primary-soft); }

/* رابط سياقي في ذيل بطاقة («التفاصيل المالية ‹») — نفس لغة .hub-link
   مختصرة: أيقونة صغيرة، نص، سهم. */
.context-link {
  width: 100%; margin-top: 12px; min-height: 48px;
  display: grid; grid-template-columns: 22px minmax(0, 1fr) 16px;
  align-items: center; gap: 10px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-weight: 700; text-align: start; cursor: pointer;
}
.context-link svg { width: 20px; height: 20px; color: var(--primary); }
.context-link > span:last-child { color: var(--muted); font-size: 1.3rem; }
.herd-category-strip {
  direction: rtl;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px -2px 10px;
  padding: 2px 2px 5px;
  scrollbar-width: none;
}
.herd-category-strip::-webkit-scrollbar { display: none; }
.herd-category-strip button {
  flex: 0 0 auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
}
.herd-category-strip button small {
  min-width: 23px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  text-align: center;
}
.herd-category-strip button[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
}
.herd-category-strip button[aria-pressed="true"] small {
  background: var(--c-white-a12);
  color: inherit;
}
.herd-search {
  min-height: 48px;
  margin-bottom: 12px;
  padding-inline-start: 14px;
  border-radius: 14px;
  background: var(--bg);
}
.herd-lot-list, .tagged-animal-list { display: grid; gap: 8px; }
.herd-lot-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.herd-lot-main { min-width: 0; display: flex; align-items: center; gap: 10px; }
.herd-lot-main strong, .herd-lot-main small { display: block; }
.herd-lot-main small, .herd-lot-count small { color: var(--muted); font-size: .76rem; }
.herd-lot-symbol, .animal-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
}
.herd-lot-symbol svg, .animal-avatar svg { width: 21px; height: 21px; }
.herd-lot-count { text-align: center; }
.herd-lot-count strong { display: block; font-size: 1.35rem; line-height: 1.1; }
.herd-lot-meta { min-width: 92px; text-align: end; }
.herd-lot-meta span, .herd-lot-meta strong { display: block; }
.herd-lot-meta span { color: var(--muted); font-size: .72rem; }
/* خيارات الدفعة: زرّ بثلاثة خطوط بعد السعر يفتح قائمة منسدلة */
.herd-lot-card.has-menu { grid-template-columns: minmax(0, 1fr) auto auto auto; }
.lot-menu { position: relative; }
.lot-menu-trigger {
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: transparent; color: var(--ink); cursor: pointer;
}
.lot-menu-trigger svg.ui-icon { width: 22px; height: 22px; }
.lot-menu-trigger:hover, .lot-menu.open .lot-menu-trigger { background: var(--surface-2); }
.lot-menu-list {
  display: none;
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 30;
  min-width: 200px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 10px 28px var(--k-lot-menu-list-shadow);
}
.lot-menu.open .lot-menu-list { display: grid; gap: 2px; }
.lot-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 9px 12px;
  font: inherit; font-weight: 700; text-align: start;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer;
}
.lot-menu-item svg.ui-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.lot-menu-item span { color: inherit; font-size: inherit; display: inline; }
.lot-menu-item:hover, .lot-menu-item:focus-visible { background: var(--surface-2); }
/* بند الخطر: نص بلون الخطر الدلالي على خلفية القائمة العادية (بلا إطار ولا تظليل افتراضي)؛ التمييز عند المرور/التركيز بتباين AA */
.lot-menu-item.lot-menu-danger { color: var(--danger); border: 0; margin: 0; width: 100%; }
.lot-menu-item.lot-menu-danger:hover, .lot-menu-item.lot-menu-danger:focus-visible { background: var(--danger-soft); color: var(--danger); }
.lot-menu-item.lot-menu-danger:focus-visible { outline: 2px solid var(--danger); outline-offset: -2px; }
.tagged-animal-card {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  text-align: start;
}
.tagged-animal-card strong, .tagged-animal-card small { display: block; }
.tagged-animal-card small { color: var(--muted); }
.herd-context-panel > .card:first-child { border-radius: 20px; }

/* ── التشغيل والتغذية: اليوم أولاً، والقوة المتقدمة عند الطلب ── */.operation-quick-card .operation-shortcuts { margin-top: 12px; }
.feed-section-tabs {
  position: sticky;
  top: 69px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
}
.feed-section-tabs button {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 650;
}
.feed-section-tabs button svg { width: 18px; height: 18px; }
.feed-section-tabs button[aria-selected="true"] {
  background: var(--tab-active-bg);
  color: var(--tab-active-ink);
}
.feed-section-content { min-height: 300px; }
.feed-context-panel > .card:first-child { border-radius: 20px; }/* تنبيه عاجل/متوسط يلفت النظر فور فتح التطبيق (مواءمة مع التطبيق الأصلي): تظليل الصف لا لون الكلمة وحدها */.operation-shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.operation-shortcuts button {
  min-height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.operation-shortcuts svg { width: 22px; height: 22px; color: var(--primary); }

.hub-list { display: grid; gap: 9px; }
.hub-arrow { color: var(--muted); font-size: 1.35rem; }

/* ── أهداف اللمس: 44px الحدّ الأدنى المعتمد (WCAG 2.5.5 / Apple HIG)
   لكل ما يُضغط بالإصبع في الحظيرة — محصور بعرض الجوال لا عاماً على
   كل شاشة، فلا يخفّف كثافة الحاسوب حيث الدقة بالفأرة لا الإصبع.
   .ghost.small تبقى مستثناة عمداً: مقصودة مدمجة في سياقات كثيفة. */
@media (max-width: 860px) {
  .ghost:not(.small) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }

  .ration-row button { min-height: 44px; }
  .perm-grid label { min-height: 44px; }
}

/* ── البطاقات: حدود نظيفة بلا ظلال ── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.02rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.stat {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: 2px; }
.stat .sub { font-size: .78rem; color: var(--muted); }

/* ── الأرقام ── */
/* الأرقام الهندية المشرقية داخل نص عربي: العزل يمنع انقلاب ترتيب
   الإشارة والرقم عند التجاور مع كلمة أو رمز لاتيني */
.num, .value, td.num, .money {
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

/* الربح والخسارة: الإشارة والسهم يحملان المعنى، واللون يؤكّده فقط —
   تحت شمس مباشرة تُغسل الألوان ويبقى «+ ↑» مقروءاً */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  unicode-bidi: isolate;
}

.delta.up { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.delta.down { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.delta.flat { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.delta .arrow { font-size: .9em; }

/* ── الجداول ── */
table { width: 100%; border-collapse: collapse; font-size: .93rem; }

th, td {
  text-align: start;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

th { color: var(--muted); font-weight: 700; font-size: .82rem; }
th.num, td.num { text-align: end; }
tbody tr:last-child td { border-bottom: 0; }

.account-statement-link {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 4px 0; border: 0; background: transparent; color: inherit;
  text-align: start; font: inherit; font-weight: 700; cursor: pointer;
}
.account-statement-link:hover, .account-statement-link:focus-visible { color: var(--primary); }
.statement-back { width: 100%; margin-bottom: 12px; }
.statement-period { display: grid; gap: 10px; margin-bottom: 12px; }
.statement-period-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.statement-period-modes button { min-width: 0; padding-inline: 8px; }
.statement-period-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.statement-period-fields label { min-width: 0; }
.statement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.statement-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.statement-list-heading h3 { margin: 0; }
.account-movement-list { display: grid; gap: 9px; }
.account-movement-card {
  width: 100%; display: grid; gap: 8px; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  text-align: start; font: inherit; cursor: pointer;
}
.account-movement-card:hover, .account-movement-card:focus-visible { border-color: var(--primary); }
.account-movement-head, .account-movement-values { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.account-movement-description { line-height: 1.65; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.latin-token { unicode-bidi: isolate; direction: ltr; font-size: .86em; opacity: .85; overflow-wrap: anywhere; }
.statement-entry-description { overflow-wrap: anywhere; }
.account-movement-values { color: var(--muted); font-size: .84rem; flex-wrap: wrap; }
.statement-debit { color: var(--primary); font-weight: 700; }
.statement-credit { color: var(--warning, var(--k-statement-credit-ink)); font-weight: 700; }
.statement-more { width: 100%; }
.statement-reference { overflow-wrap: anywhere; }
.account-entry-detail .card { margin-bottom: 14px; }

/* الجدول يصير بطاقات رأسية على الجوال: لا تمرير أفقي إطلاقاً.
   اسم البند بخطّ عريض، وتحته أزواج «مفتاح — قيمة» يقرؤها الراعي
   بنظرة واحدة بدل أن يسحب الجدول يميناً ويساراً. */
@media (max-width: 700px) {
  table, thead, tbody, tr, th, td { display: block; }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    margin-bottom: 9px;
    background: var(--surface);
  }

  tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0;
    border: 0;
    text-align: start;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .82rem;
  }

  /* الخانة الأولى عنوان البطاقة: بلا عنوان جانبي وبخطّ أعرض */
  tbody td.lead {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    padding: 0 0 7px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--line);
  }

  .statement-period-fields { grid-template-columns: 1fr; }

  tbody td.lead::before { content: none; }
  tbody td.num { text-align: start; }
}

/* ── النماذج ── */
label {
  display: block;
  margin-bottom: 5px;
  font-size: .88rem;
  color: var(--muted);
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

button { cursor: pointer; font: inherit; }

.primary {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
}

.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.ghost {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: .9rem;
}

.ghost:active { transform: translateY(1px); }
.ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

/* ── تسجيل مواليد: صف لكل مولود ── */
.offspring-box { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 12px; }
.offspring-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-2);
}
.offspring-row > strong { display: block; margin-bottom: 8px; font-size: .88rem; }

/* ── ترقية بهم لقطيع التربية: بطاقة بيانات الرأس المختار ── */
.promote-meta {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 4px 0 12px;
  background: var(--surface-2);
  font-size: .9rem;
}

/* ── حقل كلمة المرور ── */
.field { position: relative; display: block; }
.field input { padding-inline-start: 46px; }

.reveal {
  z-index: 2;
  visibility: visible;
  position: absolute;
  inset-inline-start: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.reveal:hover { color: var(--ink); background: var(--primary-soft); }
.reveal:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.reveal[aria-pressed="true"] { color: var(--primary); }
.reveal .slash { opacity: 1; }
.reveal.revealed .slash { opacity: 0; }

/* ── صفوف حصة التغذية (حاسبة التوازن الغذائي) ── */
.ration-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.ration-row {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.ration-row select, .ration-row input { margin-bottom: 0; }

.ration-row button {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}

.quick-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.quick-actions button {
  padding: 13px 10px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  font-size: .92rem;
}

.quick-actions button:active { transform: translateY(1px); }
.quick-actions button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 860px) {
  main { padding-inline: 12px; }  /* الإجراءات اليومية صف لمس واحد بدلاً من شبكة تستهلك نصف الشاشة. */
  .quick-actions {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .quick-actions::-webkit-scrollbar { display: none; }
  .quick-actions button { flex: 0 0 128px; scroll-snap-align: start; }
  .herd-section-tabs { top: 68px; }
  .herd-total-card { min-height: 150px; padding: 18px; border-radius: 20px; }
  .herd-lot-card, .herd-lot-card.has-menu { grid-template-columns: minmax(0, 1fr) auto; }
  .herd-lot-meta {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    text-align: start;
  }
  /* على الجوال: السعر وزرّ الخيارات في صف واحد بعد الخط الفاصل */
  .herd-lot-card.has-menu .herd-lot-meta {
    grid-row: 2; min-height: 52px; padding-top: 10px; padding-inline-end: 52px;
  }
  .herd-lot-card.has-menu .lot-menu { grid-row: 2; grid-column: 2; align-self: end; justify-self: end; }  .operation-shortcuts {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .operation-shortcuts::-webkit-scrollbar { display: none; }
  .operation-shortcuts button { flex: 0 0 104px; scroll-snap-align: start; }  .feed-section-tabs { top: 68px; }
}

/* ── شرائح الفئات المستهدفة (نموذج خلطة التعليف): عمودان بالجوال،
   أربعة على الشاشات الكبيرة — نفس أهداف اللمس 44px، واللون لا يحمل
   المعنى وحده: علامة ✓ ظاهرة أيضاً عند التحديد. */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  .chip-grid { grid-template-columns: repeat(4, 1fr); }
}

.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .88rem;
  text-align: center;
  cursor: pointer;
}

.chip .chip-check { display: none; }
.chip .chip-label { overflow-wrap: anywhere; }

.chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.chip[aria-pressed="true"] .chip-check { display: inline; }
.chip:active { transform: translateY(1px); }
.chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ── صفوف مكوّنات خلطة التعليف: صنف (أو اسم مخصّص) + كمّية + حذف،
   وإجمالي محسوب لا مكتوب أسفلها. تلتفّ بالجوال بدل أن تضغط الحقول
   إلى عرض غير قابل للاستعمال بالإصبع. */
.ingredient-rows { display: flex; flex-direction: column; gap: 10px; }

.ingredient-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.ingredient-row select { flex: 1 1 160px; min-width: 0; }
.ingredient-row input[type="text"] { flex: 1 1 160px; min-width: 0; }
.ingredient-row input[type="number"] { flex: 0 1 130px; min-width: 90px; }
.ingredient-row button { flex: 0 0 auto; min-height: 44px; min-width: 44px; padding: 0; }

.ingredient-total {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

/* ── جدول التحصينات (تخصيص المزرعة فوق المرجع المركزي): صف لكل
   لقاح — اسمه ودوريته، ثم شارة/زر الحالة. نفس أهداف اللمس والفواصل
   العمودية على الجوال المستعملة في .ingredient-row أعلاه. */
.vaccine-schedule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.vaccine-schedule-row input[type="number"] { width: 72px; min-height: 40px; }

/* ── الحالة الفارغة ── */
.empty-state {
  padding: 30px 20px;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.empty-state .mark { display: grid; place-items: center; color: var(--muted); line-height: 1; margin-bottom: 10px; }
.empty-state .mark .ui-icon { width: 38px; height: 38px; }
.empty-state h3 { margin: 0 0 6px; font-size: 1.02rem; }
.empty-state p { margin: 0 auto 16px; color: var(--muted); max-width: 40ch; font-size: .92rem; }
.empty-state .primary { width: auto; min-width: 190px; padding: 11px 20px; }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); }

/* خرائط GPS (geo.js) — حاوية بارتفاع صريح، وإلا انهارت Leaflet
 * لصفر ارتفاع (لا حجماً ذاتياً لمحتواها). */
.trip-map {
  width: 100%;
  min-height: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.sos-button {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  width: 100%;
  font-size: 1.05rem;
  padding: 14px;
}

/* ── الحالات والرسائل ── */
.muted { color: var(--muted); }

.error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
}

.banner {
  margin: 0;
  padding: 10px 16px;
  font-size: .89rem;
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--line);
}

.banner.bad { background: var(--danger-soft); color: var(--danger); }

.support-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}
.support-banner button { flex-shrink: 0; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .76rem;
  font-weight: 700;
}

.pill.off { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.pill.soft { border-color: var(--line); background: transparent; color: var(--muted); font-weight: 400; }
.pill.high { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.pill.warn { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }

.hint {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: .86rem;
}

.sheet-hint { margin-bottom: 8px; }

.hint code {
  font-family: ui-monospace, Consolas, monospace;
  direction: ltr;
  display: inline-block;
}

pre.report {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.7;
  background: var(--surface-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin: 0;
  /* التقارير النصية مصفوفة بمسافات وخطّ ثابت العرض: اتجاهها لاتيني
     وإلا تناثرت أعمدتها داخل الصفحة العربية */
  direction: ltr;
  text-align: left;
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(var(--bar) + 20px + env(safe-area-inset-bottom));
  margin: 0 auto;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-block: 12px;
  padding-inline-start: 16px;
  padding-inline-end: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  z-index: 50;
  font-size: .92rem;
}

.toast.bad { background: var(--danger); border-color: var(--danger); color: var(--c-white); }

.toast-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.toast-action:focus-visible { outline: 2px solid var(--bg); outline-offset: -3px; }

/* ── ورقة الإدخال السريع ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--k-sheet-backdrop-bg);
}

.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 41;
  max-height: 78vh;
  max-height: min(78dvh, calc(var(--vvh, 100dvh) - 16px)); /* المساحة المرئية فوق لوحة المفاتيح (core.js ينشر --vvh) */
  overflow-y: auto;
  /* تمرير الورقة بالإصبع حتى نهايتها لا يُسرّب الحركة إلى الصفحة
     خلفها (ارتداد الخلفية على iOS/أندرويد) — إزعاج حقيقي في نموذج
     طويل كتسجيل عملية بحقول كثيرة. */
  overscroll-behavior: contain;
  padding: 10px 12px calc(18px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
}

/* لوحة المفاتيح: الثابتات تتبع التخطيط لا المرئي (iOS)، فنرفع أسفل الورقة إلى أسفل المرئي = 100dvh − (--vvh + --vv-top). على أندرويد (تُصغَّر الصفحة) الفرق صفر. */
html.kb-open .sheet { bottom: max(0px, calc(100dvh - var(--vvh) - var(--vv-top, 0px))); }
html.kb-open .modal-backdrop:has(.record-sheet) { bottom: max(0px, calc(100dvh - var(--vvh) - var(--vv-top, 0px))); }
html.kb-open .record-sheet { max-height: min(92dvh, calc(var(--vvh, 100dvh) - 16px)); }

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 2px auto 12px;
  border-radius: 999px;
  background: var(--line);
}

.sheet h2 { margin: 0 0 10px; font-size: 1rem; }

/* ── الدرج المنزلق (drawer) — تفصيل موضوع بيطري كامل ──
 *
 * مكوّن جديد كلياً، لا امتداد لـ.sheet: تلك تثبّت أسفل الشاشة بلا أي
 * حركة، وهذا ينزلق أفقياً من حافة الشاشة (RTL يحدّد الاتجاه تلقائياً
 * عبر inset-inline-end/translateX المنطقيَّين — بلا تفريع dir يدوي). */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--k-drawer-backdrop-bg);
}

.drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 46;
  width: min(420px, 100vw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.drawer-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.drawer-close:hover { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 480px) {
  .drawer { width: 100vw; }
}/* السهم يشير للحالة بدل الاعتماد على انفتاح القائمة وحده كإشارة */.menu-item {
  display: block;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: .96rem;
  text-align: start;
}

.menu-item:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
/* خروج الجلسة يُفصل بصرياً عن أزرار التنقّل: نتيجته مختلفة تماماً
 * — تصفح شاشة غير إنهاء الجلسة — والنص "خروج" يحمل المعنى لا اللون
 * وحده. */
.menu-item.danger {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-top: 16px;
  color: var(--danger);
}
.menu-item.danger:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }

/* (حُذفت قاعدة ركن الشاشة ≥861 للأوراق: من 768 كل .sheet في وسط الشاشة بمكان ثابت — DP-27، القاعدة في css/copper.css) */

/* ── بطاقات الرعاية ── */
.care-label { margin-top: 13px; font-size: .82rem; font-weight: 700; color: var(--primary); }
.care-label:first-child { margin-top: 0; }
.care-list { margin: 5px 0 0; padding-inline-start: 20px; }
.care-list li { margin-bottom: 4px; }
.care-text { margin: 5px 0 0; }
.mix-head { margin-bottom: 10px; }
.mix-head .small { font-size: .82rem; margin-top: 2px; }

.code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: .82em;
  color: var(--muted);
  direction: ltr;
  display: inline-block;
}

.alert-row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  touch-action: pan-y;
  transition: transform .18s ease, opacity .18s ease;
}

.alert-row:last-child { border-bottom: 0; }
.alert-row .small { font-size: .85rem; }
/* زرّ «افتح» في الإشعارات كان بلا نمط (مستطيل خام بحدّ رفيع وارتفاع ≈24px): كبسولة بهدف لمس مريح بلون التمييز */
:is(html, html[data-ui]) .alert-open { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--primary); background: transparent; color: var(--primary); font-weight: 700; cursor: pointer; }
.alert-body { flex: 1 1 auto; min-width: 0; }

/* زر بديل للسحب — ضروري لمن لا يستعمل اللمس، ونفس نتيجة السحب */
.alert-dismiss {
  flex: 0 0 auto;
  align-self: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.alert-dismiss:hover { background: var(--danger-soft); color: var(--danger); }
.alert-dismiss:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.alert-row details { margin-top: 2px; }
.alert-row summary {
  display: inline-block;
  padding: 4px 0;
  color: var(--primary);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
}

/* عنوان القسم يفرز "عاجل الآن" عن "تحتاج متابعة" بالكلمة والموضع
   والوزن — لا باللون وحده، وبلا خط جانبي زخرفي. */
.alert-group-label {
  padding: 11px 10px 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
}

.alert-group-label.critical {
  color: var(--danger);
  font-size: .8rem;
}

.dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.warn, .dot.warning { background: var(--warn); }
.dot.high, .dot.danger, .dot.error { background: var(--danger); }
.dot.info, .dot.ok { background: var(--primary); }

.perm-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.perm-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: .89rem;
  font-weight: 400;
}

.perm-grid input { width: auto; margin: 0; }

/* تشغيلية ومالية بصرياً منفصلتان — لا يقرأ المالك قائمة مسطّحة
 * من اثنتي عشرة خانة فيخلط ما يأمن منحه عاملاً بما لا يأمنه. */
.perm-section { margin-bottom: 12px; }
.perm-section-title {
  margin: 0 0 8px;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
}

/* زر إزالة مستخدم: أثره لا رجعة فيه على دخوله فوراً، فيُميَّز
 * بلون الخطر لا يُترك شبيهاً بأي زر آخر في البطاقة. */
.danger {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-weight: 700;
}
.danger:hover:not(:disabled) { background: var(--danger-soft); }
.danger:disabled { opacity: .5; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── صفّ خيارات الدخول ── */
.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  min-height: 44px;
  font-weight: 400;
  color: var(--ink);
  font-size: .88rem;
  cursor: pointer;
}

.check input { width: auto; margin: 0; }

.linkish {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linkish:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* زر المظهر المختار */
.quick-actions button.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

/* ═══════════════════════ حسابي ═══════════════════════
 * هوية أولاً، ثم مجموعات أفعال بحسب الصلاحية؛ الإعدادات التفصيلية
 * ثلاث مساحات سياقية لا صفحة رأسية واحدة. */
.account-profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at 86% 18%, color-mix(in srgb, var(--primary) 17%, transparent), transparent 30%),
    linear-gradient(140deg, var(--surface), color-mix(in srgb, var(--primary-soft) 62%, var(--surface)));
  overflow: hidden;
}
.account-identity h1 { margin: 2px 0 6px; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.account-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.account-badges span {
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}
.account-farm-name { min-width: 150px; text-align: end; }
.account-farm-name small { display: block; color: var(--muted); margin-bottom: 3px; }
.account-farm-name strong { font-size: .95rem; }

/* الدور أول ما يُقرأ في بطاقة الهوية — يميَّز عن شارة الباقة. */
.account-badges .account-role-badge {
  background: var(--primary); border-color: var(--primary);
  color: var(--primary-ink); font-weight: 700;
}
.account-groups { display: grid; gap: 20px; }
.account-group-heading { margin-bottom: 9px; }
.account-group-heading h2 { margin: 2px 0 0; font-size: 1.12rem; }
.account-action-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }   /* AUD-9/23 (T-61): كل بند صف مستقل بسهمه */
.account-action-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: start;
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease;
}
.account-action-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.account-action-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.account-action-icon svg { width: 21px; height: 21px; }
.account-action-copy { min-width: 0; }
.account-action-copy strong,
.account-action-copy small { display: block; }
.account-action-copy strong { margin-bottom: 3px; }
.account-action-copy small { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.account-action-copy .plan-chip { justify-self: start; width: max-content; max-width: 100%; }  /* DP-19: شارة «تجريبية» بحجم نصها لا بعرض السطر (small أعلاه block) */

.settings-page-intro { margin-bottom: 12px; }
.settings-page-intro h1 { margin: 2px 0; }
.settings-context-panel > .card,
.settings-context-panel > .disclose { margin-bottom: 10px; }

@media (max-width: 640px) {
  .account-profile-hero { grid-template-columns: auto 1fr; gap: 11px; padding: 16px; border-radius: 20px; }  .account-farm-name { grid-column: 1 / -1; min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); text-align: start; }
  .account-farm-name small, .account-farm-name strong { display: inline; }
  .account-farm-name small { margin-inline-end: 6px; }  .account-action-grid { grid-template-columns: 1fr; }
  .account-action-card { min-height: 78px; padding: 12px; }}

/* ── حقل حساب: عنوان صغير فوق قيمته، لا جدول بعمودين ── */
.profile-field {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.profile-field:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-field:first-child { padding-top: 0; }
.profile-field .small { display: block; margin-bottom: 2px; }

/* ── رأس شاشة التسجيل: العملية المختارة لا قائمة بكلّ شيء ── */
.record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.record-head strong { font-size: 1.08rem; }
.record-head .small { font-size: .8rem; }

.ghost.small { padding: 5px 11px; font-size: .82rem; }

/* أزرار ورقة التأكيد: متجاورة بعرض متساوٍ */
.sheet .row { margin-top: 14px; }
.sheet .row > button { flex: 1 1 120px; width: auto; }

/* ── الأقسام المطويّة ── */
.disclose {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 9px;
  background: var(--surface);
}

.disclose[open] { border-color: var(--primary); }/* علامة + تصير − عند الفتح: تقول الحالة بلا لون ولا صورة */.card-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-heading h2 { margin: 0; }
.page-intro h1 { display: flex; align-items: center; gap: 8px; }
.info-help { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 0;
  background: transparent; color: var(--primary); font-size: 22px; border-radius: 50%; }
.info-help:hover, .info-help[aria-expanded="true"] { background: var(--primary-soft); }
.info-popover { position: fixed; inset: auto; margin: 0; width: min(320px, calc(100vw - 24px));
  max-height: min(60vh, 420px); overflow: auto; box-sizing: border-box; padding: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface, var(--bg));
  color: var(--ink); box-shadow: 0 8px 30px var(--k-info-popover-shadow); line-height: 1.7; z-index: 10000; }
.info-popover p { margin: 0; }
.info-popover .hint { font-size: inherit; color: inherit; }
.disclosure-item { position: relative; }
.disclosure-item > .disclose-row { width: 100%; }
.disclosure-item .disclose-row-copy { margin-inline-start: 36px; }
.disclosure-item > .info-help { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); }
.info-locked > .plan-locked-card { width: 100%; padding-inline-start: 56px; }
.info-account > .account-action-card { width: 100%; padding-inline-start: 56px; height: 100%; }/* ── عناصر اللوحة ── */
.small { font-size: .85rem; }
.alert-row .pill { margin-inline-start: 6px; }
.card > .ghost { margin-top: 12px; width: 100%; }

/* ── دفتر مهام اليوم: تبديل بلمسة واحدة ── */
.task-row {
  display: block;
  width: 100%;
  text-align: start;
  padding: 11px 14px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: .93rem;
}

.task-row:last-child { margin-bottom: 0; }
.task-row:hover { border-color: var(--primary); }
.task-row:active { transform: translateY(1px); }
.task-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.task-row.on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* مهمة مباشرة عاجلة: حدّ أحمر لا يعتمد على اللون وحده — النص "🔴"
 * قبل العنوان يحمل نفس المعنى لمن لا يميّز الألوان أو تحت شمس قوية. */
.task-row.urgent { border-color: var(--danger); }

/* ── رابط دليل التفعيل: زرّ يحمل href لا onclick ── */
/* ═══════════════════════ سوق مراح ذكي ═══════════════════════
 * باب داخل التطبيق الخماسي، لكنه يملك شخصية سوق واضحة من غير أن
 * يتحول إلى «وضع نظام» منفصل أو يخفي شريط التنقّل الأساسي. */

.market-shell-head {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--line));
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--primary) 15%, transparent), transparent 36%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--primary-soft) 72%, var(--surface)));
  overflow: hidden;
}

.market-head-row,
.market-brand,
.market-discovery-title,
.market-search-row,
.market-card-meta {
  display: flex;
  align-items: center;
}

.market-head-row { justify-content: space-between; gap: 20px; }
.market-brand { gap: 14px; }
.market-brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 18px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 1.65rem;
  transform: rotate(-3deg);
}
.market-brand h1 { margin: 1px 0 2px; font-size: clamp(1.45rem, 4vw, 2rem); }
.market-brand p { margin: 0; color: var(--muted); font-size: .9rem; }
.market-head-actions { flex: 0 0 auto; }
.market-sell-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.market-sell-action span:first-child { font-size: 1.25rem; line-height: 1; }
.market-discovery {
  margin-bottom: 16px;
  padding: 4px 2px 0;
}
.market-discovery-title { justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.market-discovery h2 { margin: 2px 0 0; font-size: 1.25rem; }
.market-results-count {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 700;
}
.market-search-row { gap: 8px; }
.market-search-row .market-search { flex: 1 1 auto; margin: 0; min-width: 0; }
.market-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
}

.market-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}
.market-card { position: relative; }
.market-card:hover { transform: translateY(-2px); border-color: var(--primary); }
/* البطاقة كلها تفتح العرض: زر العنوان (عنصر حقيقي) يمتدّ فوقها؛ المفضلة أعلى منه */
.market-card-open { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; min-height: 44px; min-width: 0; cursor: pointer; color: inherit; font: inherit; text-align: start; }
.market-card-open::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.market-card-open:focus-visible { outline: none; }
.market-card-open:focus-visible::after { outline: 3px solid var(--primary); outline-offset: -3px; }
.market-card .market-fav-overlay { z-index: 2; }
/* سطر أعلى سعر مقدَّم (الفيد والبث المثبَّت) */
.market-offer { display: grid; gap: 1px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--primary-soft); }
.market-offer b { color: var(--ink); font-size: .95rem; }
.market-offer span { color: var(--muted); font-size: .76rem; }
.market-offer.none { background: var(--surface-2); }
.market-offer.none span { font-size: .82rem; font-weight: 600; }
.live-panel .market-offer { background: color-mix(in srgb, currentColor 14%, transparent); }
.live-panel .market-offer b { color: inherit; }
.live-panel .market-offer span { color: inherit; opacity: .8; }
/* بطاقة الأسعار المقدَّمة في التفصيل */
.market-offer-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.market-offer-log .alert-row { flex-wrap: wrap; }
.market-bid-feed .dot:not(.info) { background: var(--muted); }
.market-bid-form { display: grid; gap: 10px; margin-top: 14px; }
.market-bid-form label { margin: 0; }
.market-bid-note { margin: 12px 0 0; }
.market-card-visual { position: relative; }
.market-cover { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.market-media-frame { width: 100%; height: 100%; background: var(--surface-2); }
.market-media-frame img,
.market-media-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* بطاقة التصفّح: الصور الرأسية (الغالبة) تملأ الإطار 4:5 مع تركيز أعلى قليلاً، والأفقية كاملة (contain) فوق نسخة ضبابية */
.market-cover .market-media-frame img { object-position: 50% 38%; }
.market-media-frame.fit-blur { position: relative; overflow: hidden; }
.market-media-frame.fit-blur .market-media-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(18px) brightness(.72); transform: scale(1.2);
}
.market-media-frame.fit-blur > img:not(.market-media-bg) { position: relative; z-index: 1; object-fit: contain; }
.market-cover-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  height: 100%;
  color: var(--muted);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--primary-soft) 75%, var(--surface)), var(--surface-2));
}
.market-cover-placeholder span { font-size: 2.25rem; filter: grayscale(.15); }
.market-cover-placeholder small { font-size: .75rem; }
.market-media-count {
  position: absolute;
  inset-inline-end: 9px;
  bottom: 9px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--c-black-a70);
  color: var(--c-white);
  font-size: .75rem;
  font-weight: 800;
}
.market-card-body { display: flex; flex: 1; flex-direction: column; gap: 7px; padding: 14px; }
.market-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.market-card-title strong { font-size: 1.04rem; }
.market-card-title span { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.market-price { color: var(--ink); font-size: 1.02rem; }
.market-card-meta { justify-content: space-between; gap: 8px; color: var(--muted); font-size: .78rem; }
.market-card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-filter-empty { grid-column: 1 / -1; }

/* معرض صفحة التفاصيل: الارتفاع ثابت والعرض يتبع نسبة كل صورة (لا قصّ) — شريط أفقي قابل للتمرير */
.market-gallery {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.market-gallery .market-media-frame {
  flex: 0 0 auto;
  width: auto;
  min-width: 140px;
  max-width: 92%;
  height: clamp(300px, 52vw, 460px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  scroll-snap-align: start;
}
.market-gallery .market-media-frame img { width: auto; max-width: 100%; height: 100%; object-fit: contain; }
.market-gallery .market-media-frame video { width: min(92vw, 520px); height: 100%; object-fit: contain; background: var(--video-bg); }
.market-listing-detail { max-width: 820px; margin-inline: auto; }
.market-listing-detail > .card { margin-bottom: 12px; }

/* رأس صفحة التفاصيل: العنوان أولاً، ثم المنطقة/الوقت/العدد، ثم
 * البائع والتواصل — قبل الوصف والوسائط (طلب المالك 2026-09-29). */
.market-detail-head { margin-bottom: 14px; }
.market-detail-title { margin: 0 0 8px; font-size: 1.3rem; line-height: 1.35; }
.market-detail-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  color: var(--muted); font-size: .82rem; margin-bottom: 10px;
}
.market-seller-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-text { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.icon-text .ui-icon { width: 1.1em; height: 1.1em; flex: 0 0 auto; }
a.icon-text, a.ghost.small { text-decoration: none; }
.market-detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.market-follow-row { margin: 12px 0; }
.market-owner-photos { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 12px; }
.market-owner-photos h3 { margin: 0 0 8px; font-size: 1rem; }
.market-bubble-icon { display: inline-flex; }
.market-bubble-icon .ui-icon { width: 1.1em; height: 1.1em; }
input::placeholder, textarea::placeholder { font-weight: 400; opacity: .5; }
.market-seller-name { font-weight: 700; margin-inline-end: auto; }
.market-seller-link, .market-comment-author { border: 0; background: transparent;
  color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-align: start; padding: 0; }
.market-seller-link:hover, .market-comment-author:hover { color: var(--primary); text-decoration: underline; }
.market-follow-button { min-height: 38px; white-space: nowrap; }
.market-like-button[aria-pressed="true"] { color: var(--danger); }
.market-public-profile { display: grid; gap: 16px; }
.market-public-profile > .ghost { justify-self: start; }
.market-profile-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); }
.market-profile-hero h1 { font-size: 1.3rem; margin: 0 0 6px; }
.market-profile-stats, .market-profile-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.market-profile-stats { color: var(--muted); font-size: .86rem; }
.market-profile-actions { margin-inline-start: auto; }
/* عروض مشابهة (على نمط حراج): شبكة صور مربّعة صغيرة بزوايا مدوّرة وعنوان قصير تحتها */
.market-similar-scroll { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; padding-bottom: 6px; }
@media (min-width: 640px) { .market-similar-scroll { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.market-similar-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 0; text-align: start;
  cursor: pointer; font: inherit; color: inherit; background: none; border: 0; }
.market-similar-tile .market-cover { aspect-ratio: 1 / 1; border-radius: 14px; }
.market-similar-text strong { font-size: .8rem; font-weight: 600; line-height: 1.4; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.market-saved-alert { width: 100%; text-align: start; padding: 12px 15px;
  border: 1px solid var(--primary); border-radius: 12px;
  background: var(--primary-soft); color: var(--ink); font: inherit; font-weight: 700;
  cursor: pointer; margin-bottom: 12px; }
.market-saved-list { display: grid; gap: 10px; }
.market-saved-item { display: grid; gap: 7px; padding: 12px;
  border: 1px solid var(--line); border-radius: 10px; }
.market-detail-description { margin: 0 0 14px; white-space: pre-wrap; }
.market-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 28px; }
.market-detail-actions button { min-height: 44px; flex: 1 1 145px; }
.market-owner-sale-form { display: grid; gap: 12px; }
.market-owner-sale-form > p { margin: 0; }
.market-owner-sale-form label { display: grid; gap: 5px; font-weight: 650; }
.market-owner-sale-form input, .market-owner-sale-form select,
.market-owner-sale-form textarea { width: 100%; min-height: 43px; }
.market-owner-summary { display: flex; justify-content: space-between; gap: 12px;
  align-items: center; padding: 13px 15px; border-radius: 12px;
  background: var(--primary-soft); }
.market-owner-summary strong { font-size: 1.05rem; }
.market-owner-secondary { border-top: 1px solid var(--line); margin-top: 15px;
  padding-top: 12px; display: flex; justify-content: flex-end; }
.market-owner-secondary button { color: var(--danger); }

/* ببلات المعلومات الإضافية — أيقونة وتسمية فقط، تفتح بطاقة منبثقة */
.market-bubble-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.market-bubble-row .market-info-bubble { width: auto; min-height: 36px; padding: 0 12px; font-size: .85rem; }
.market-info-bubble {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: .85rem;
  font-weight: 700; cursor: pointer;
}
.market-info-bubble:hover { background: var(--surface-2); }

.market-context-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--primary-soft);
}
.market-context-intro h2 { margin: 2px 0; font-size: 1.2rem; }
.market-context-intro p { margin: 0; color: var(--muted); font-size: .86rem; }
.market-context-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 15px;
  background: var(--surface);
  font-size: 1.25rem;
}
.market-context-icon.live { color: var(--danger); font-size: 1.7rem; }
.market-request-list { display: grid; gap: 9px; }
.market-request-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.market-request-mark {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: .72rem;
  font-weight: 800;
}
.market-request-count { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.market-request-card p { margin: 5px 0 0; font-size: .84rem; }
.market-request-region { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.market-live-card { padding: 16px; }

.market-bid-feed { margin-top: 8px; }
.market-bid-feed .alert-row { margin-bottom: 6px; }

/* الزر يتغيّر نصّاً كاملاً بين الوضعين (renderRoot) — لا أيقونة وحدها،
 * فلا يُساء فهمه على أنه إشعار أو زر عادي. */
/* وضع الحراج مضاء بلون مختلف قليلاً عن المزرعة في الشريط العلوي —
 * إشارة مكانية إضافية إلى أي "تطبيق" يقف فيه المستخدم الآن. */
body.mode-market .topbar { border-bottom-color: var(--primary); }

@media (max-width: 640px) {
  .market-shell-head { margin-inline: -4px; padding: 16px 14px 13px; border-radius: 20px; }
  .market-head-row { align-items: flex-start; }
  .market-brand { gap: 10px; }
  .market-brand-mark { width: 44px; height: 44px; flex-basis: 44px; border-radius: 14px; font-size: 1.35rem; }
  .market-brand p { display: none; }
  .market-sell-action { min-height: 40px; padding: 8px 11px; }
  .market-sell-action span:last-child { display: none; }  .market-search-row { align-items: stretch; }
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .market-card-body { padding: 10px; gap: 5px; }
  .market-card-title { align-items: flex-start; flex-direction: column; gap: 1px; }
  .market-price { font-size: .88rem; }
  .market-card-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
  .market-card-meta span:first-child { display: none; }
  .market-gallery .market-media-frame { height: 320px; }
  .market-context-intro { padding: 14px; }
  .market-request-card { grid-template-columns: auto 1fr; }
  .market-request-region { grid-column: 2; }
}

/* ── البث الحيّ — شاشة تجريبية بلا نقل فيديو فعلي، ومُعلَنة كذلك
 * بصراحة داخل الشاشة نفسها لا في توثيق منفصل لا يراه أحد. */

.stream-canvas {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: repeating-linear-gradient(
    135deg, var(--surface-2, var(--k-stream-canvas-bg-1)) 0, var(--surface-2, var(--k-stream-canvas-bg-2)) 10px,
    transparent 10px, transparent 20px);
  text-align: center;
  padding: 16px;
}

.stream-canvas-badge {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  font-size: .82rem;
}

.stream-canvas-note {
  color: var(--muted);
  font-size: .85rem;
  max-width: 320px;
}

.stream-chat-log {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  padding-inline-end: 4px;
}

.stream-stage { min-height: 560px; padding: 0; overflow: hidden; background: var(--k-stream-stage-bg); color: white; border: 0; }
.stream-stage .stream-canvas-badge { z-index: 3; }
.stream-media-host { width: 100%; min-height: 560px; }
.stream-media-host > p { padding: 48px 16px 8px; color: white; }
.stream-media-host .agora-videos { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stream-media-host .agora-videos > div { min-height: 480px; width: 100%; }
.stream-chat-overlay { position: absolute; bottom: 0; inset-inline: 0; z-index: 2; padding: 14px; text-align: start; background: linear-gradient(transparent, var(--k-stream-chat-overlay-bg)); pointer-events: none; }
.stream-chat-overlay .stream-chat-log { height: 180px; max-width: 85%; pointer-events: auto; overscroll-behavior: contain; }
.stream-chat-message { color: white; text-shadow: 0 1px 3px var(--c-black); overflow-wrap: anywhere; padding: 3px 8px; border-radius: 8px; background: var(--c-black-a20); width: fit-content; }
.stream-chat-message strong { color: var(--k-stream-chat-message-ink); }
.stream-chat-composer { display: flex; gap: 8px; pointer-events: auto; }
.stream-chat-composer input { flex: 1; min-width: 0; color: white; background: var(--k-stream-chat-composer-bg); border-color: var(--k-stream-chat-composer-line); }
.stream-chat-composer input::placeholder { color: var(--c-gray-eee); }
.stream-chat-composer button { color: white; background: var(--k-stream-chat-composer-bg); }
.emergency-alert { position: fixed; z-index: 10000; inset-inline: 12px; top: 80px; max-height: 70vh; overflow: auto; padding: 22px; background: var(--surface); border: 3px solid var(--danger); border-radius: 16px; box-shadow: 0 8px 40px var(--k-emergency-alert-shadow); }
.emergency-alert strong { color: var(--danger); font-size: 1.25rem; }
.emergency-alert button { display: block; margin-top: 12px; }
.sos-button { touch-action: none; user-select: none; }
.sos-button.holding { outline: 4px solid var(--danger-soft); }/* ── نشر عرض: نموذج بخمس خطوات بدل قائمة حقول مكدّسة (شكوى مالك
   حقيقية: النموذج طويل بلا تسلسل بصري، طلب 2026-09-29) ── */

.wizard-progress { margin-bottom: 16px; }
.wizard-progress-track {
  height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px;
}
/* scaleX لا width — تغيير width يُعيد حساب التخطيط (layout) عند كل
   خطوة، وscaleX/transform طبقة تركيب بلا إعادة تخطيط. الأصل يمتدّ
   العرض الكامل دائماً، والتحويل من نقطة اليمين (بداية القراءة في
   RTL) يحاكي نفس امتلاء width التقليدي بصرياً. */
.wizard-progress-fill {
  width: 100%; height: 100%; background: var(--primary);
  transform: scaleX(0); transform-origin: right center;
  transition: transform .2s ease;
}
.wizard-progress-text { color: var(--muted); font-size: .78rem; font-weight: 700; }
.wizard-step { display: flex; flex-direction: column; }
.wizard-nav { margin-top: 8px; }
.wizard-nav button { flex: 1 1 auto; }

.media-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 90px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease;
}
.media-dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.media-dropzone:has(.media-input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
/* متصفح بلا :has (iOS < 15.4): نُبقي حلقة التركيز للوحة المفاتيح بدل إسقاطها */
@supports not selector(:has(*)) { .media-dropzone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; } }
/* حقل الملف الحقيقي شفاف فوق المنطقة كلها: اللمسة تقع عليه فيفتح منتقي iOS مرة واحدة (بلا click() برمجي ولا display:none) */
.media-dropzone .media-input {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
}
.media-field-label { display: block; margin-bottom: 5px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.media-status { margin: 6px 0 0; }
.media-status:empty { margin: 0; }

/* الفراغ يتّسع لمنطقة لمس زر الحذف (44px) فلا تتداخل مع منطقة الاختيار ولا مع المصغّرة المجاورة */
.media-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.media-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.media-thumb.is-pending, .media-thumb.is-failed { display: flex; align-items: center; justify-content: center; background: var(--surface-2); }
.media-thumb.is-failed { border-color: var(--danger); color: var(--danger); }
.media-thumb-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  animation: marah-loading .9s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .media-thumb-spin { animation-duration: 3s; } }
.media-thumb-remove {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: var(--k-media-thumb-remove-bg);
  color: var(--c-white);
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
/* مساحة لمس 44px حول زر الحذف (الزر نفسه 20px) */
.media-thumb-remove::after { content: ''; position: absolute; inset: -12px; }
.bid-response-form {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }

/* ── التعليقات العامة (نقاش حرّ يحاكي مساومة الحراج)، والمفاوضة الخاصة ── */

.market-comments-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.market-comment {
  position: relative;
  padding: 8px 34px 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.market-comment.seller { background: var(--primary-soft); }
.market-comment-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.market-comment-meta strong { font-size: .86rem; }
.market-comment-meta .pill { font-size: .68rem; padding: 1px 7px; }
.market-comment-text { color: var(--ink); font-size: .92rem; word-break: break-word; }
.market-comment .icon-action {
  position: absolute; top: 4px; inset-inline-end: 4px;
  width: 28px; height: 28px; min-height: 28px; padding: 0;
  display: grid; place-items: center;
}
.market-comment .icon-action svg.ui-icon { width: 16px; height: 16px; }

.market-report-btn { align-self: flex-start; color: var(--danger); border-color: var(--danger-soft); }

/* مربّع كتابة التعليق كبير، وزرّ الإرسال أصغر تحته لا بجانبه (طلب
   المالك) — سؤال أو سوم قد يمتدّ أكثر من سطر. */
.market-comment-composer { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.market-comment-composer textarea { margin-bottom: 0; resize: vertical; }
.market-comment-send { width: auto; align-self: flex-start; padding: 9px 28px; }

.negotiation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink, var(--c-white));
  font-size: .8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
}

.negotiation-log {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.negotiation-msg { padding: 6px 10px; border-radius: 10px; background: var(--surface-2); max-width: 80%; }
.negotiation-msg.mine { align-self: flex-end; background: var(--primary-soft); }

/* إعلان راعٍ — بانر بسيط أعلى اللوحة الرئيسية أو شبكة الحراج
 * (core.js: adBanner، الموجة الثانية). زر لا صورة ساكنة: كل البطاقة
 * قابلة للنقر، متّسقة مع بقية عناصر التفاعل في هذا النظام. */
.ad-banner {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  text-align: right;
  margin-bottom: 12px;
}
.ad-media {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
.ad-caption {
  padding: 8px 12px;
  font-size: .85rem;
  color: var(--muted);
  background: var(--surface-2);
}

/* إعلان الرئيسية: مباشرة بعد الترحيب، بعرض المساحة كاملة ومن دون قص
   الصورة في الشاشات الواسعة. إعلان السوق يبقى بمكوّنه المعتاد. */
.dashboard-ads-container {
  grid-column: 1 / -1;
  min-width: 0;
}
.dashboard-ads-container:empty { display: none; }
.ads-carousel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.ads-slide { animation: ad-fade-in .28s ease-out; }
.ads-slide .ad-banner {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.ads-slide .ad-media {
  width: 100%;
  height: clamp(140px, 22vw, 240px);
  max-height: none;
  object-fit: contain;
  background: var(--surface-2);
}
@keyframes ad-fade-in {
  from { opacity: .45; }
  to { opacity: 1; }
}
.ads-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--k-ads-nav-line);
  border-radius: 50%;
  background: var(--k-ads-nav-bg);
  color: var(--k-ads-nav-ink);
  box-shadow: 0 3px 12px var(--k-ads-nav-shadow);
  font-size: 1.65rem;
  line-height: 1;
  transform: translateY(-50%);
}
.ads-nav:hover { background: var(--c-white); }
.ads-nav-prev { right: 12px; }
.ads-nav-next { left: 12px; }
.ads-dots {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--surface-2);
}
.ads-dot {
  position: relative;
  width: 32px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
}
.ads-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  opacity: .45;
  transform: translate(-50%, -50%);
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.ads-dot.active::after {
  width: 18px;
  background: var(--primary);
  opacity: 1;
  transform: translate(-50%, -50%) scaleX(2.25);
}

.ads-dot::after {
  transform: translate(-50%, -50%) scaleX(1);
}
@media (max-width: 640px) {
  .ads-carousel { border-radius: 15px; }
  .ads-slide .ad-media { height: clamp(120px, 38vw, 170px); }
  .ads-nav { width: 40px; height: 40px; }
  .ads-nav-prev { right: 8px; }
  .ads-nav-next { left: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .ads-slide { animation: none; }
  .ads-dot::after { transition: none; }
}

/* تمرير وتظليل صف مخزون علف محدَّد — وصولاً من رابط تنبيه (app.js:
 * navigateToAlertTarget). تلاشٍ لا لون ثابت: الإشارة مؤقتة لا تصبح
 * سمة دائمة للصف. */
.row-highlight { animation: row-flash 2.4s ease-out; }
@keyframes row-flash {
  0% { background: var(--warn-soft); }
  100% { background: transparent; }
}

/* ── نافذة منبثقة عامة — عرض كلمة مرور مؤقّتة، بديل alert() ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--c-black-a45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  /* مناطق الأمان (النتوء/الحواف المنحنية) في الاتجاه الأفقي أيضاً، فلا يلامس صندوق النافذة الحافة */
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  z-index: 80;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 20px;
  max-width: 420px;
  width: 100%;
  max-height: 85vh;
  /* dvh يتبع الارتفاع المرئي فعلاً (شريط المتصفح)، ولا يزيد عن المساحة بعد حشوة الخلفية فلا يُقصّ الصندوق في الارتفاعات القصيرة */
  max-height: min(85dvh, calc(100dvh - 32px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-box h2 { margin-top: 0; }

/* حركة النوافذ الموحَّدة (Wave 6): مدة واحدة لكل نافذة في #modal-root ولكل الثيمات (--modal-ms)، ثمّ يبقى لكل ثيم
 * شكل حركته (مفاتيحه في css/*.css) بمدة المشترك. الكلاسيكي كان بلا حركة فأخذ تلاشياً وارتفاعاً خفيفين. الإغلاق
 * يمهل closeModal() (core.js) هذه المدة بصنف is-closing؛ بلا حركة عند reduced-motion (والمهلة تُلغى في JS). */
:root { --modal-ms: 200ms; }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-fade-out { to { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; translate: 0 16px; } }
@media (prefers-reduced-motion: no-preference) {
  .modal-backdrop { animation: modal-fade var(--modal-ms) ease-out backwards; }
  .modal-box { animation: modal-rise var(--modal-ms) ease-out backwards; }
  #modal-root .modal-backdrop { animation-duration: var(--modal-ms); }
  #modal-root .modal-backdrop > .modal-box { animation-duration: var(--modal-ms); }
  #modal-root .modal-backdrop.is-closing { animation: modal-fade-out var(--modal-ms) ease-in forwards; }
}
#modal-root .modal-backdrop.is-closing { pointer-events: none; }
.season-popup-modal {
  max-width: 360px;
  padding: 16px;
  border-radius: 18px;
}
.season-popup-title { display: flex; align-items: center; gap: 10px; }
.season-popup-title > svg {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.season-popup-title .section-kicker { font-size: .68rem; }
.season-popup-title h2 { margin: 1px 0 0; font-size: 1rem; }
.season-hijri { margin: 8px 0; color: var(--muted); font-size: .72rem; }
.season-popup-item {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: .76rem;
}
.season-popup-item.featured { background: var(--primary-soft); border-color: transparent; }
.season-popup-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.season-popup-item-head strong { font-size: .86rem; }
.season-days { color: var(--primary); font-weight: 750; white-space: nowrap; }
.season-date { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.season-popup-item p { margin: 6px 0 0; line-height: 1.55; }
.season-popup-more { display: grid; gap: 7px; margin-top: 8px; }
.season-popup-more[hidden] { display: none; }
.season-popup-actions { display: flex; gap: 8px; margin-top: 12px; }
.season-popup-actions button { min-height: 40px; padding: 8px 12px; font-size: .76rem; }
.season-popup-actions .season-expand { flex: 1; }
.season-popup-actions .season-close { width: auto; min-width: 72px; }
/* رأس خطوة معالج «إضافة مجموعة جديدة» (openCensusLotWizard) — كسرة
 * section-kicker القائمة فوق h2 القياسي، بلا صندوق جديد. */
.wizard-step-header { margin-bottom: 14px; }
.wizard-step-header .section-kicker { display: block; margin-bottom: 4px; }
.password-reveal-row { align-items: stretch; }
.password-reveal-input {
  font-family: ui-monospace, "Courier New", monospace;
  letter-spacing: .04em;
  direction: ltr;
  text-align: center;
}
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.row-actions > * { flex: 1 1 140px; }

/* ── حقول حساب: شبكة صفَّين لا سطراً ممتدّاً واحداً لكل حقل ── */
.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 28px;
}
@media (max-width: 640px) {
  .profile-fields { grid-template-columns: 1fr; }
}

/* ── دردشة بفقاعات — يمين/يسار حسب المرسل، وقت وعلامة قراءة ── */
.chat-bubble-row {
  display: flex;
  margin-bottom: 4px;
}
.chat-bubble-row.mine { justify-content: flex-start; }
.chat-bubble-row.theirs { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.chat-bubble-row.mine .chat-bubble {
  background: var(--primary-soft);
  border-color: var(--primary-soft);
}
.chat-bubble-sender {
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}
.chat-bubble-text { white-space: pre-wrap; word-break: break-word; }
.chat-bubble-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
  font-size: .72rem;
  color: var(--muted);
}
.chat-tick { letter-spacing: -1px; }
.chat-tick.read { color: var(--primary); }

/* ── شارة عدد غير المقروء على أيقونة/تبويب الدردشة ── */
.chat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-inline-start: 6px;
  border-radius: 999px;
  background: var(--danger);
  color: var(--c-white);
  font-size: .7rem;
  font-weight: 700;
  vertical-align: middle;
}

/* ══════════════════════ الدردشة — إعادة بناء كاملة ══════════════════════
 *
 * شقّان على الحاسوب (قائمة يمين + محادثة يسار — ترتيب DOM وحده يكفي
 * تحت RTL)، وتنقّل كامل الشاشة بزر رجوع على الجوال (`.conversation-open`
 * على `.chat-shell` تبدّل أيّهما ظاهر). */

.chat-shell {
  display: flex;
  height: min(76vh, 720px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.chat-sidebar {
  width: 320px;
  flex: 0 0 320px;
  border-inline-end: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chat-canvas {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-empty-canvas {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

@media (min-width: 861px) {
  .chat-back { display: none; }
}

@media (max-width: 860px) {
  /* ارتفاع الشلّ = المساحة المرئية الفعلية (visualViewport عبر --vvh في core.js) − إزاحته العلوية (--chat-top من chat.js) − الشريط السفلي الفعلي. كان
   * `min-height: calc(100vh - var(--bar) - 220px)`: تخميناً بالارتفاع الأكبر، فتنتهي الدردشة قبل الشريط بفراغ ≈ 214px ويبقى الحقل في منتصف الشاشة. */
  .chat-shell {
    height: calc(100dvh - var(--chat-top, 0px) - var(--bar-h, var(--bar))); /* dvh يتبع شريط المتصفح السفلي تلقائياً (--vvh كان يتأخر عنه فيترك فراغاً) */
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
  body:has(.chat-shell) { overflow: hidden; } /* الدردشة تملأ الشاشة؛ لا تمرير للصفحة تحتها يكشف فراغاً */
  :is(html, html[data-ui]) body:has(.chat-shell) main { padding-bottom: 0; } /* تتجاوز حشوة main السفلية الخاصة بالمظاهر */
  /* لوحة المفاتيح ظاهرة: الدردشة تملأ المساحة المرئية بالكامل (حقل الكتابة ملتصق بأعلى المفاتيح) ولا يطفو شريط التنقل فوقها */
  html.kb-open body .bottombar { display: none; } /* خصوصية أعلى من قواعد الشريط في المظاهر */
  html.kb-open .chat-shell {
    position: fixed;
    top: var(--vv-top, 0px);
    inset-inline: 0;
    height: var(--vvh);
    z-index: 70;
    background: var(--surface);
  }
  .chat-sidebar { width: 100%; flex: 1 1 auto; border-inline-end: 0; }
  .chat-shell:not(.conversation-open) .chat-canvas { display: none; }
  .chat-shell.conversation-open .chat-sidebar { display: none; }
}

/* ── تبويبان مقسَّمان: مباشرة/فريق ── */
.chat-segmented {
  display: flex;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.chat-segmented button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 6px;
  min-height: 44px;   /* DP-28 (T-61): هدف لمس 44 */
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.chat-segmented button.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}

/* ── صفّ بدء محادثة جديدة ── */
.chat-new-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.chat-new-row input { flex: 1; margin: 0; }
.chat-new-row button { margin: 0; white-space: nowrap; }
/* الحقل يأخذ المساحة والزر بحجم محتواه: زرّ primary بعرض كامل في الثيمات كان يعصر الحقل إلى شريحة */
:is(html, html[data-ui]) .chat-new-row { align-items: center; }
:is(html, html[data-ui]) .chat-new-row input { flex: 1 1 0; min-width: 0; width: auto; margin: 0; font-size: 16px; }
:is(html, html[data-ui]) .chat-new-row button { flex: 0 0 auto; width: auto; margin: 0; padding-inline: 18px; white-space: nowrap; }

/* ── قائمة المحادثات: بطاقة أفقية موحَّدة لكل عنصر ── */
.chat-list { flex: 1; overflow-y: auto; }
.chat-empty-list { padding: 16px; text-align: center; }

.chat-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 12px;
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.chat-tile:hover, .chat-tile.active { background: var(--surface-2); }

/* ── دليل البيطريين (web/js/modules/vets.js) ── */
.vet-row { cursor: pointer; }
.vet-row:hover, .vet-row:focus-visible { background: var(--surface-2); }
.cash-shortfall-pill { margin-inline-start: 6px; }
.warn-note { color: var(--warn); font-size: .92em; margin: 6px 0; }
.vet-verified-badge { color: var(--primary); font-weight: 650; font-size: .85em; }
.vet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.vet-filters { display: grid; gap: 8px; margin-bottom: 10px; }
.vet-filters .chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.vet-row .row-actions { display: flex; gap: 8px; margin-top: 8px; }
.vet-row .row-actions > * { flex: 1; text-align: center; display: flex; align-items: center; justify-content: center; min-height: 42px; }
.record-sheet a.button { text-decoration: none; }
.vet-locate { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.vet-locate svg { width: 18px; height: 18px; }
.vet-confirm-note { background: var(--warn-soft, var(--k-vet-confirm-note-bg)); color: var(--warn, var(--k-vet-confirm-note-ink)); border-radius: 8px; padding: 8px 10px; font-size: .9em; margin: 6px 0; }
.vet-animal-list { max-height: 50vh; overflow-y: auto; display: grid; gap: 2px; margin: 8px 0; }
.vet-animal-row { padding: 8px 4px; border-bottom: 1px solid var(--line, var(--c-gray-eee)); }
.vet-steps { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 10px; }
.vet-step { display: flex; align-items: center; gap: 10px; color: var(--muted, var(--k-vet-step-ink)); }
.vet-step.done { color: var(--ink, var(--k-vet-step-done-ink)); }
.vet-step.now { font-weight: 700; }
.vet-step-dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2, var(--c-gray-eee)); font-size: .85em; flex: 0 0 auto; }
.vet-step.done .vet-step-dot { background: var(--primary, var(--k-done-vet-step-dot-bg)); color: var(--c-white); }
.vet-media-row { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.vet-media { height: 110px; width: auto; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
/* بطاقة الطبيب: صورة دائرية، نص ثانوي بتباين AA (--ink لا --muted الباهت)، زر رئيسي بنص الثيم الفاتح */
.vet-card-head { display: flex; align-items: center; gap: 12px; }
.vet-card-id { display: grid; gap: 2px; min-width: 0; }
.vet-name { font-size: 1.05rem; overflow-wrap: anywhere; }
.vet-title { color: var(--ink); opacity: .78; font-size: .88rem; }
.vet-avatar { width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
  background: var(--primary-soft, var(--c-gray-eee)); color: var(--primary, var(--k-vet-avatar-ink)); font-weight: 800; font-size: 1.3rem; border: 2px solid var(--line, var(--c-gray-ddd)); }
.vet-avatar.big { width: 64px; height: 64px; font-size: 1.6rem; }
.vet-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vet-meta { margin: 4px 0; font-size: .9rem; color: var(--ink); opacity: .85; }
.vet-stars { color: var(--warn, var(--k-vet-stars-ink)); font-weight: 700; letter-spacing: 1px; }
.vet-row .pill.vet-tag { background: var(--surface-2, var(--k-pill-vet-tag-bg)); color: var(--ink, var(--k-pill-vet-tag-ink)); border: 1px solid var(--line, var(--k-pill-vet-tag-line)); font-weight: 500; }
.vet-actions { display: flex; gap: 8px; margin-top: 10px; }
.vet-actions .vet-cta { flex: 2; min-height: 46px; background: var(--primary); color: var(--primary-ink, var(--c-white)); border: 0; border-radius: 12px; font-weight: 800; }
.vet-actions .vet-secondary { flex: 1; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--surface, var(--c-white)); }
.vet-actions .vet-secondary svg { width: 18px; height: 18px; }
/* تبويب داخلي (segmented) يختلف عن كبسولات الفلاتر الصغيرة */
.vet-segment { display: flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface-2, var(--k-vet-segment-bg)); border: 1px solid var(--line, var(--k-vet-segment-line)); margin-bottom: 10px; }
.vet-seg { flex: 1; min-height: 46px; border: 0; border-radius: 11px; background: transparent; color: var(--ink); font-weight: 700; font-size: 1rem; }
.vet-seg.on { background: var(--surface, var(--c-white)); box-shadow: 0 1px 4px var(--k-vet-seg-on-shadow); color: var(--primary); }
.vet-topbar { margin-bottom: 10px; }
.vet-topbar .vet-emergency { width: 100%; min-height: 52px; font-size: 1.05rem; }
/* صفّا الفلاتر: بلا شريط تمرير، وتدرّج على الحافة التي فيها المزيد */
.vet-filters .chip-row { scrollbar-width: none; -ms-overflow-style: none; }
.vet-filters .chip-row::-webkit-scrollbar { display: none; }
.vet-filters .chip-row.fade-l { -webkit-mask-image: linear-gradient(to right, transparent 0, var(--c-black) 36px); mask-image: linear-gradient(to right, transparent 0, var(--c-black) 36px); }
.vet-filters .chip-row.fade-r { -webkit-mask-image: linear-gradient(to left, transparent 0, var(--c-black) 36px); mask-image: linear-gradient(to left, transparent 0, var(--c-black) 36px); }
.vet-filters .chip-row.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent 0, var(--c-black) 36px, var(--c-black) calc(100% - 36px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, var(--c-black) 36px, var(--c-black) calc(100% - 36px), transparent 100%); }
.vet-network { text-align: center; display: grid; gap: 8px; justify-items: center; }
/* هيكل التحميل */
.vet-skeleton { display: grid; gap: 10px; }
.sk-line, .vet-avatar.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2, var(--c-gray-eee)) 25%, var(--line, var(--c-gray-ddd)) 50%, var(--surface-2, var(--c-gray-eee)) 75%); background-size: 200% 100%; animation: vet-shimmer 1.2s infinite linear; }
.sk-line { height: 12px; }
.sk-line.w80 { width: 80%; } .sk-line.w60 { width: 60%; } .sk-line.w50 { width: 50%; } .sk-line.w40 { width: 40%; }
@media (prefers-reduced-motion: reduce) { .sk-line, .vet-avatar.sk { animation: none; } }
@keyframes vet-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.vet-topbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.vet-topbar button { flex: 1; min-height: 44px; }
button.danger-fill { background: var(--danger, var(--k-danger-fill-bg)); color: var(--on-danger, var(--c-white)); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; }
.vet-filters .chip-row { display: flex; gap: 6px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.vet-filters .chip { flex: 0 0 auto; white-space: nowrap; }
.vet-cta-bar { position: sticky; bottom: 0; display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 0 2px; margin-top: 14px; background: var(--surface, var(--c-white)); border-top: 1px solid var(--line, var(--c-gray-ddd)); }
.vet-cta-bar button { flex: 1 1 auto; min-height: 44px; }
.vet-estimate { background: var(--surface-2, var(--k-vet-estimate-bg)); border-radius: 10px; padding: 10px; margin: 10px 0; display: grid; gap: 4px; }
.vet-target { display: grid; gap: 8px; }
.vet-section { margin-top: 14px; }
.vet-section h3 { font-size: 1em; margin: 0 0 6px; }
.vet-offer { padding: 8px 0; border-bottom: 1px solid var(--line); }
.chat-tile.active { border-inline-start: 3px solid var(--primary); }

.chat-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--c-white);
  font-weight: 700;
  font-size: 1rem;
}

.chat-tile-body { flex: 1; min-width: 0; }
.chat-tile-top, .chat-tile-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-tile-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-tile-time { flex: 0 0 auto; font-size: .72rem; color: var(--muted); }
.chat-tile-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  color: var(--muted);
}
.chat-unread-dot {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: .7rem;
  font-weight: 700;
}

/* ── رأس المحادثة النشطة ── */
.chat-conv-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.chat-conv-title { display: flex; flex-direction: column; min-width: 0; }
.chat-conv-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-log {
  min-height: 0;
  overscroll-behavior: contain;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

/* ── مرفقات داخل الفقاعة ── */
.chat-media-wrap { display: flex; flex-direction: column; gap: 6px; }
.chat-media-img {
  display: block;
  max-width: 220px;
  max-height: 260px;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: zoom-in;
  background: var(--surface-2);
  object-fit: cover;
}
.chat-lightbox { display: grid; place-items: center; }
.chat-lightbox-img { max-width: min(80vw, 720px); max-height: 76vh; border-radius: var(--radius-sm); }

.chat-file-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  max-width: 220px;
}
.chat-file-icon { font-size: 1.3rem; }
.chat-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}
.audio-play-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: var(--primary-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.audio-progress {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  overflow: hidden;
}
.audio-progress-fill { height: 100%; width: 0%; background: var(--primary); }
.audio-time { font-size: .72rem; color: var(--muted); min-width: 34px; }

/* ── شريط الإدخال الحديث ── */
.chat-composer-wrap { border-top: 1px solid var(--line); }
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px;
}
.chat-icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.chat-icon-btn:hover { background: var(--surface-2); }
.chat-send-btn { background: var(--primary); color: var(--primary-ink); }
.chat-send-btn:hover { background: var(--primary); filter: brightness(1.08); }

.chat-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
  padding: 4px 12px;
}
.chat-input-wrap textarea {
  border: 0;
  background: transparent;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
  margin: 0;
  font: inherit;
}
.chat-input-wrap textarea:focus { outline: none; }

.chat-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 8px;
  font-size: .82rem;
}
.chat-attach-remove {
  border: 0;
  background: var(--surface);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--danger);
}

/* ── شريط التسجيل الصوتي ── */
.chat-recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}
.chat-recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: chat-rec-pulse 1.1s ease-in-out infinite;
}
@keyframes chat-rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
.chat-recording-time { font-variant-numeric: tabular-nums; color: var(--muted); flex: 1; }

/* ── المجتمع — تغذية فيديو مشتركة بين البيطريين والمزارعين (القاعدة
 * 46 في CLAUDE.md). باب مساعد من «الرئيسية» — بطاقة رابط بسيطة، لا
 * تبويب سفلي جديد. */.community-author { display: flex; flex-direction: column; gap: 1px; }
.community-author strong { font-size: .92rem; }

.community-media-player {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius, 12px);
  background: var(--video-bg);
  margin: 8px 0;
}

.community-comments { display: flex; flex-direction: column; gap: 10px; }
.community-comment {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.community-comment:last-child { border-bottom: none; }

/* رصيد ميزان المراجعة: مبلغ وطرفه، بلا لون ربح/خسارة. رصيد على غير
   طبيعة حسابه (أصل دائن، دَين مدين) وحده يُميَّز — هو ما يستحق النظر. */
.balance-side { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; }
.balance-side small { color: var(--muted); font-weight: 600; font-size: .75rem; }
.balance-side.abnormal { color: var(--danger); }
.balance-side.abnormal small { color: var(--danger); }

/* ── الشركاء والدعم الشهري ── */
.page-heading { margin: 4px 0 14px; }
.page-heading h1 { margin: 2px 0 0; font-size: 1.35rem; }
.support-heading { margin: 22px 0 10px; }
.partner-form { display: grid; gap: 10px; }
.partner-form label { display: grid; gap: 5px; }
.share-total { margin: 4px 0; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 700; }
.share-total.ok { background: var(--primary-soft); color: var(--primary); }
.share-total.off { background: var(--warn-soft); color: var(--warn); }
.support-months { display: grid; gap: 10px; }
.support-month {
  display: grid; gap: 6px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.support-month.late { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.support-month-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.support-month-head small { font-size: .78rem; font-weight: 700; }
.support-month-head small.late, .support-late { color: var(--danger); font-weight: 700; }
.support-month-head small.paid, .support-paid { color: var(--primary); }
.support-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2, transparent);
  border: 1px solid var(--line);
}
.support-line strong, .support-line small { display: block; }
.support-line small { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.support-state { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.support-state.late { color: var(--danger); }
.support-state.paid { color: var(--primary); }
/* Daily workspace: a single visual hierarchy, shared across the five doors.
   Scoped overrides keep specialist forms and the independent admin app intact. */
.dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.dashboard-workspace > * { min-width: 0; }
.dashboard-daily-actions,
.dashboard-ads-container { grid-column: 1 / -1; }
.dashboard-workspace .card { margin-bottom: 0; border-radius: 18px; }
.dashboard-workspace h2 { font-size: 1rem; }
.dashboard-workspace .metric-value { margin-top: 6px; font-size: 2.4rem; }
.dashboard-daily-actions { padding: 14px 16px; }
.dashboard-daily-actions .operation-shortcuts {
  display: grid;
  overflow: visible;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-top: 8px;
}
.dashboard-daily-actions .operation-shortcuts button {
  min-height: 72px; border-color: transparent; border-radius: 14px;
  background: var(--primary-soft); font: inherit; font-weight: 650;
}
.dashboard-section-heading { gap: 8px; margin-bottom: 6px; }
.text-action { min-height: 44px; padding: 6px 10px; border: 0; background: var(--primary-soft); }
.dashboard-tasks .task-context-content > .card {
  border: 0; padding: 0; background: transparent; border-radius: 0;
}
.task-context-content h2 { color: var(--muted); font-size: .8rem; font-weight: 500; margin: 4px 0 8px; }
.task-context-switch { display: flex; gap: 6px; margin-bottom: 10px; }
.task-context-switch button {
  flex: 1; min-height: 44px; padding: 6px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: .8rem;
}
.task-context-switch button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.market-brand-mark svg { width: 27px; height: 27px; }
.market-cover-placeholder { gap: 8px; }
.market-cover-placeholder svg { width: 48px; height: 48px; }
.market-cover-placeholder small { font-size: .78rem; }
.market-context-icon svg { width: 28px; height: 28px; }
.herd-section-tabs, .feed-section-tabs { top: var(--topbar-height); border-radius: 14px; }
.herd-section-tabs button, .feed-section-tabs button { min-height: 44px; border-radius: 10px; }
.herd-section-tabs button[aria-selected="true"],
.feed-section-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.topbar { min-height: var(--topbar-height); }
#view > .context-link { margin: 0 0 14px; width: fit-content; font-size: .85rem; }
.who strong, .who .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text { overflow: hidden; }
@media (max-width: 860px) {
  .topbar { height: var(--topbar-height); padding: 8px 12px; gap: 8px; }
  .topbar-actions { gap: 4px; }
  .dashboard-workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }  .dashboard-daily-actions { order: 1; }  .dashboard-tasks { order: 3; }
  .dashboard-ads-container { order: 5; }  .fab {
    bottom: calc(var(--bar) + 10px + env(safe-area-inset-bottom));
    width: auto; height: 48px; padding: 0 18px;
    display: flex; gap: 7px; border: 2px solid var(--surface); border-radius: 999px;
  }
  .fab span { font-size: .82rem; line-height: 1.3; font-weight: 700; }
  .fab svg { width: 20px; height: 20px; }
  main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .bottombar button { border-top: 0; padding: 6px 2px; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) { background: var(--primary-soft); border-radius: 14px; }
  .bottombar { padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); gap: 4px; }
}
@media (max-width: 480px) {
  .market-grid { grid-template-columns: minmax(0, 1fr); }
  .market-card-body { padding: 14px; }
}
/* Phone workspace: all four field actions remain in view, with no
   sideways scrolling or hidden actions on narrow screens. */.dashboard-daily-actions .daily-action { min-width: 0; }
.dashboard-daily-actions .daily-action svg { width: 27px; height: 27px; }
.dashboard-daily-actions .daily-action-alert { background: var(--danger-soft); }
.dashboard-daily-actions .daily-action-alert svg { color: var(--danger); }
.dashboard-daily-actions .daily-action-flask { background: var(--surface-2); }
.dashboard-daily-actions .daily-action-feed { background: var(--warn-soft); }
.dashboard-daily-actions .daily-action-feed svg { color: var(--warn); }
@media (max-width: 860px) {
  .dashboard-daily-actions .operation-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  }
  .dashboard-daily-actions .daily-action {
    min-height: 90px; padding: 12px 6px; gap: 7px; font-size: .95rem;
  }  .dashboard-workspace .metric-value { font-size: 2rem; }  input, select, textarea { font-size: 16px; }}

/* Field-first edition: quiet surfaces, purposeful hierarchy, bespoke symbols.
   Secondary destinations are deliberately absent from the home workspace. */
.dashboard-workspace { gap: 22px; max-width: 1000px; margin-inline: auto; }
.dashboard-ads-container:empty { display: none; }
.dashboard-workspace .season-peek-button { background: var(--k-dashboard-workspace-season-peek-button-bg); border: 1px solid var(--k-dashboard-workspace-season-peek-button-line); border-radius: 14px; color: var(--k-dashboard-workspace-season-peek-button-ink); }
.dashboard-workspace .dashboard-daily-actions { padding: 0; background: transparent; border: 0; box-shadow: none; }
.dashboard-daily-actions .dashboard-section-heading { margin: 0 2px 16px; align-items: center; }
.dashboard-daily-actions h2 { font-size: 1.08rem; }
.dashboard-daily-actions .operation-shortcuts { gap: 12px; }
.dashboard-daily-actions .operation-shortcuts .daily-action {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 128px; gap: 13px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 21px;
  color: var(--ink); font-size: .96rem; text-align: start;
  box-shadow: var(--shadow-tile);
}
.daily-action-symbol { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--primary-soft); color: var(--primary); }
.dashboard-daily-actions .daily-action .ui-icon { width: 31px; height: 31px; }
.daily-action-mortality .daily-action-symbol { background: var(--danger-soft); color: var(--danger); }
.daily-action-health .daily-action-symbol { background: var(--surface-2); }
.daily-action-feed .daily-action-symbol { background: var(--warn-soft); color: var(--warn); }
.dashboard-daily-actions .operation-shortcuts .daily-action:active { transform: scale(.98); background: var(--surface-2); }
.dashboard-workspace .dashboard-tasks-empty { padding: 4px 14px; background: transparent; border: 1px dashed var(--line); }
.dashboard-tasks-empty .dashboard-section-heading { margin: 0; }
.dashboard-tasks-empty h2 { font-size: .88rem; color: var(--muted); }
.dashboard-tasks-empty .text-action { background: transparent; font-size: .8rem; }
.subscriber-market-index { padding-bottom: 32px; }
.subscriber-market-index .market-price-value { font-size: 1.12rem; font-weight: 700; color: var(--primary); }
body:has(.subscriber-market-index) #fab { display: none; }
.account-action-card { border-radius: 18px; }
@media (max-width: 860px) {
  .dashboard-workspace { gap: 20px; }  .dashboard-daily-actions .operation-shortcuts { gap: 12px; }
  .bottombar { border-top: 1px solid var(--line); background: var(--surface); }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) { background: transparent; color: var(--primary); }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .ui-icon { background: var(--primary-soft); border-radius: 10px; box-sizing: content-box; padding: 4px 12px; margin: -4px -12px; }
}
@media (max-width: 350px) {
  .dashboard-daily-actions .operation-shortcuts .daily-action { padding: 15px; font-size: .88rem; }
  .dashboard-daily-actions h2 { font-size: .98rem; }
}

/* ── باقة المزرعة: ميزة مقفلة تظهر بمكانها بقفل أنيق لا تختفي ──
 * (scripts/plans.py). نافذة الترقية، بطاقة الميزة المقفلة، قفل الباب،
 * وملاحظة مدة كشف الحساب — كلها من رموز التصميم نفسها فتعمل في الوضعين. */
.plan-upgrade { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 6px 4px 2px; }
.plan-upgrade h2 { margin: 4px 0 0; font-size: 1.15rem; }
.plan-upgrade p { margin: 0; line-height: 1.7; }
.plan-upgrade .row-actions { width: 100%; justify-content: center; margin-top: 8px; }
.plan-upgrade-badge {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary-soft) 45%, transparent);
}
.plan-upgrade-badge .ui-icon { width: 30px; height: 30px; }
.plan-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); font-size: .75rem; font-weight: 800;
  white-space: nowrap;
}
.plan-chip.current { background: var(--primary-soft); color: var(--primary); margin-bottom: 8px; }
.plan-locked-card {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: start;
  padding: 12px 14px; margin: 8px 0; border-radius: var(--radius);
  border: 1px dashed color-mix(in srgb, var(--warn) 40%, var(--line));
  background: color-mix(in srgb, var(--warn-soft) 40%, var(--surface)); color: var(--ink); cursor: pointer;
}
.plan-locked-card:hover { border-style: solid; }
.plan-locked-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.plan-locked-icon {
  flex: 0 0 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--warn-soft); color: var(--warn);
}
.plan-locked-icon .ui-icon { width: 20px; height: 20px; }
.plan-locked-text { flex: 1; display: grid; gap: 2px; }
.plan-locked-text small { color: var(--muted); font-size: .78rem; }
.nav-lock { display: inline-grid; place-items: center; color: var(--warn); }
.nav-lock .ui-icon { width: 13px; height: 13px; }
.bottombar .nav-icon-shell { position: relative; }
.bottombar .nav-icon-shell .nav-lock {
  position: absolute; inset-block-start: -4px; inset-inline-end: -8px;
  background: var(--surface); border-radius: 50%; padding: 2px;
}
.plan-locked-nav { opacity: .82; }
.plan-history-note {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--ink);
  font-size: .85rem;
}
.plan-history-note .ui-icon { width: 18px; height: 18px; color: var(--warn); }
.plan-history-note span { flex: 1; min-width: 12rem; }
.card.plan-current { border-color: var(--primary); }

/* ── الأيقونات ثنائية الطبقة (web/js/modules/icons.js) ──
 * الكتلة الخفيفة (.ui-tone) تتوهّج في الموضع النشط دون رسم ثانٍ. */
.ui-icon .ui-tone { transition: opacity .2s ease; }
.tabs button:is([aria-selected="true"], [aria-current="page"]) .ui-tone { opacity: .32; }

/* الشريط السفلي على الجوال: خمس أيقونات بلا مسمّيات — التسمية مخفية
 * بصرياً فقط (قارئ الشاشة يقرؤها، وaria-label يحملها أيضاً). */
@media (max-width: 860px) {
  .bottombar button .nav-label {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .bottombar button { background: transparent; border-radius: 0; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) { background: transparent; color: var(--primary); }
  .bottombar .nav-icon-shell {
    display: grid; place-items: center; width: 56px; height: 42px; border-radius: 15px;
    transition: background .2s ease, transform .15s ease;
  }
  .bottombar button svg.ui-icon { width: 28px; height: 28px; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .ui-icon {
    background: none; padding: 0; margin: 0; border-radius: 0;
  }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .nav-icon-shell { background: var(--primary-soft); }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .ui-tone { opacity: .4; }
  .bottombar button:active .nav-icon-shell { transform: scale(.93); }
  .bottombar button:focus-visible .nav-icon-shell {
    outline: 2px solid var(--primary); outline-offset: 2px;
  }
}

/* ── الدردشة بالأيقونات الجديدة والقناة العامة (web/js/modules/chat.js) ── */
.chat-icon-btn svg.ui-icon { width: 22px; height: 22px; }
.chat-send-btn svg.ui-icon .ui-tone { opacity: .35; }
.chat-send-btn:disabled { opacity: .45; cursor: default; }
.audio-play-btn svg.ui-icon { width: 16px; height: 16px; }
.chat-file-icon { display: inline-grid; place-items: center; color: var(--primary); }
.chat-file-icon svg.ui-icon { width: 22px; height: 22px; }
.chat-attach-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chat-attach-name svg.ui-icon { width: 18px; height: 18px; flex: 0 0 auto; }

.chat-segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.chat-segmented button svg.ui-icon { width: 18px; height: 18px; }
.chat-segmented button.on .ui-tone { opacity: .35; }

.chat-avatar-icon { color: var(--primary-ink); }
.chat-avatar-icon svg.ui-icon { width: 24px; height: 24px; }
.chat-avatar-icon .ui-tone { opacity: .3; }
.chat-avatar-icon.public { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--c-amber))); }
.chat-avatar-icon.team { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 80%, var(--video-bg)), var(--primary)); }

.chat-public-intro { margin: 0; padding: 10px 12px 0; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.chat-bubble-row.public-row { align-items: flex-end; gap: 8px; }
.chat-bubble-row.public-row .chat-avatar { width: 30px; height: 30px; font-size: .8rem; }
.public-sender { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.public-sender .public-name { color: var(--ink); }
.public-sender .public-farm { font-weight: 500; color: var(--muted); font-size: .72rem; }
.mod-badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: .68rem; font-weight: 800;
}
.mod-badge svg.ui-icon { width: 13px; height: 13px; }
.mod-badge.self { font-size: .72rem; }
.chat-bubble.is-deleted { background: transparent; border-style: dashed; }
.is-deleted-text { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; font-size: .85rem; }
.is-deleted-text svg.ui-icon { width: 15px; height: 15px; }
.chat-edited { font-style: italic; }
.chat-menu { display: grid; gap: 10px; }
.chat-menu h2 { margin: 0; font-size: 1.05rem; }
.chat-menu label { display: grid; gap: 5px; font-size: .85rem; }
.chat-menu textarea { width: 100%; font: inherit; }
.chat-menu-quote {
  margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.chat-menu-action {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; font: inherit;
  font-weight: 700; text-align: start; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.chat-menu-action svg.ui-icon { width: 20px; height: 20px; color: var(--primary); }
.chat-menu-action.danger, .chat-menu-action.danger svg.ui-icon { color: var(--danger); }
.chat-menu-action:hover { background: var(--surface-2); }
button.primary.danger { background: var(--danger); border-color: var(--danger); }
.chat-suspended-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 8px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--ink);
}
.chat-suspended-note svg.ui-icon { width: 22px; height: 22px; color: var(--danger); flex: 0 0 auto; }
.chat-suspended-note div { display: grid; gap: 3px; }
.chat-suspended-note small { color: var(--muted); line-height: 1.6; }

/* ── الهوية الجديدة (2026-09-28): أيقونات بلون واحد، الشعار وحده ملوّن،
 * ولون تمييز واحد (فيروزي الشعار = --primary). يعلو ما سبقه عمداً. ── */
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; }
.login-card .brand-logo { width: 56px; height: 56px; }
.tabs button:is([aria-selected="true"], [aria-current="page"]) .ui-tone { opacity: .14; }
.chat-avatar-icon.public, .chat-avatar-icon.team { background: var(--primary); }
.chat-avatar-icon .ui-tone { opacity: 0; }

@media (max-width: 860px) {
  .bottombar button { color: var(--muted); }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) { color: var(--ink); background: transparent; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .nav-icon-shell { background: transparent; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .ui-tone { opacity: .14; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) svg.ui-icon { stroke-width: 2; }
  .bottombar .nav-icon-shell { position: relative; }
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .nav-icon-shell::after {
    content: ""; position: absolute; bottom: -3px; left: 50%; width: 5px; height: 5px;
    margin-left: -2.5px; border-radius: 50%; background: var(--primary);
  }
  .bottombar button svg.ui-icon { width: 27px; height: 27px; }
}

/* شريط الدردشة بنمط واتساب: كبسولة (نصّ + مشبك + كاميرا + ميكروفون يساراً)
 * وزرّ إرسال دائري مستقل بلون التمييز */
.chat-composer-wrap { border-top: 0; padding: 6px 8px 8px; }
.chat-composer { align-items: flex-end; gap: 8px; padding: 0; }
.chat-capsule {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 24px;
  padding: 3px 6px 3px 4px; min-height: 48px;
}
.chat-capsule .chat-input-wrap { flex: 1; min-width: 0; padding-inline-start: 10px; }
.chat-capsule .chat-input-wrap textarea {
  background: transparent; border: 0; box-shadow: none; padding: 11px 0; min-height: 40px;
}
.chat-capsule .chat-icon-btn { width: 40px; height: 40px; color: var(--muted); background: transparent; }
.chat-capsule .chat-icon-btn:hover { color: var(--ink); background: transparent; }
.chat-capsule .chat-icon-btn svg.ui-icon { width: 23px; height: 23px; }
.chat-composer > .chat-send-btn {
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink);
}
.chat-composer > .chat-send-btn svg.ui-icon { width: 22px; height: 22px; }
.chat-composer > .chat-send-btn:disabled { opacity: .5; }

/* حقل الدردشة المشترك (الفريق/المباشرة/العامة): الكبسولة وحدها الإطار، والحقل
 * عنصر مرن بلا حدود ولا إطار تركيز خاص — قواعد الثيمات (copper/modern/wasm) على
 * textarea:focus كانت تغلّف الحقل بإطار ثانٍ داخل الكبسولة فيضيق ويُقصّ.
 * `:is(html, html[data-ui])` يرفع الأولوية فوق قواعد الثيم. */
:is(html, html[data-ui]) .chat-capsule {
  gap: 4px; padding: 4px 6px; min-height: 52px; align-items: flex-end;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 26px;
}
:is(html, html[data-ui]) .chat-capsule:focus-within { border-color: var(--primary); }
:is(html, html[data-ui]) .chat-capsule .chat-input-wrap {
  flex: 1 1 auto; min-width: 0; border: 0; border-radius: 0; background: transparent;
  box-shadow: none; padding: 0 4px;
}
:is(html, html[data-ui]) .chat-capsule .chat-input-wrap textarea,
:is(html, html[data-ui]) .chat-capsule .chat-input-wrap textarea:focus,
:is(html, html[data-ui]) .chat-capsule .chat-input-wrap textarea:focus-visible {
  display: block; width: 100%; min-height: 44px; max-height: 120px; margin: 0;
  padding: 12px 2px; border: 0; border-radius: 0; background: transparent;
  box-shadow: none; outline: none; resize: none;
  font: inherit; font-size: 16px; line-height: 1.45; color: var(--ink);
}
:is(html, html[data-ui]) .chat-capsule .chat-input-wrap textarea::placeholder { color: var(--muted); opacity: 1; }
:is(html, html[data-ui]) .chat-capsule .chat-icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
:is(html, html[data-ui]) .chat-composer > .chat-send-btn { width: 52px; height: 52px; }
.chat-plus-btn.is-open { color: var(--primary); }
.chat-tools-tray { display: flex; gap: 8px; padding: 2px 4px 8px; }
.chat-tools-tray .chat-icon-btn {
  width: auto; height: 44px; padding: 0 16px; border-radius: 22px; gap: 8px;
  display: inline-flex; align-items: center; font-size: .95rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
}

/* بطاقات الترحيب: سطح واحد هادئ مشتق من فيروزي الشعار بدل أخضر وذهبي
 * مكتوبين يدوياً — النص الأبيض يبقى مقروءاً في الوضعين *//* الإجراءات السريعة: مربّعات محايدة وأيقونات بلون واحد */
.daily-action-symbol,
.dashboard-daily-actions .daily-action-alert,
.dashboard-daily-actions .daily-action-feed,
.dashboard-daily-actions .daily-action-flask {
  background: var(--surface-2); color: var(--ink);
}
.dashboard-daily-actions .daily-action-alert svg,
.dashboard-daily-actions .daily-action-feed svg { color: var(--ink); }
/* الكبسولة وحدها إطار الإدخال — لا صندوق ثانٍ بداخلها */
.chat-capsule .chat-input-wrap { border: 0; background: transparent; border-radius: 0; padding: 0 0 0 0; padding-inline-start: 10px; }
@media (max-width: 860px) {
  .bottombar button:is([aria-selected="true"], [aria-current="page"]) .nav-icon-shell::after { bottom: -6px; }
}
/* أيقونات الإجراءات السريعة بلون واحد على مربّع محايد — لا أحمر ولا أصفر */
.daily-action .daily-action-symbol,
.daily-action-mortality .daily-action-symbol,
.daily-action-health .daily-action-symbol,
.daily-action-feed .daily-action-symbol,
.daily-action-birth .daily-action-symbol { background: var(--surface-2); color: var(--ink); }
.chat-segmented button.on .ui-tone { opacity: .14; }
:root { --profile-avatar-bg: var(--k-x-profile-avatar-bg); }
.profile-avatar { display:inline-flex; align-items:center; justify-content:center; overflow:hidden; border-radius:50%; background:var(--profile-avatar-bg); color:var(--k-profile-avatar-ink); font-weight:800; vertical-align:middle; }
.profile-avatar img { width:100%; height:100%; object-fit:cover; }
.profile-avatar.is-default { background: transparent; }   /* AUD-9/10 (T-61): الصورة الافتراضية المرسومة بلا قرص خلفها */
.profile-avatar.is-default img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.brand .brand-wordmark { width:210px; height:105px; object-fit:contain; }
.topbar .brand-wordmark { width:74px; height:40px; object-fit:contain; flex-shrink:0; }

/* MARAH: a quiet wordmark surrounded by the green and gold loading ring. */
.brand-loading { display: flex; justify-content: center; align-items: center; min-height: 220px; padding: 24px; }
.brand-loader { position: relative; display: flex; align-items: center; justify-content: center; width: 112px; height: 112px; border-radius: 50%; background: var(--c-white); box-shadow: 0 8px 26px var(--k-brand-loader-shadow); }
.brand-loader-ring { position: absolute; inset: 0; border: 3px solid var(--k-brand-loader-ring-line); border-top-color: var(--k-brand-loader-ring-border-top-color); border-right-color: var(--k-brand-loader-ring-border-right-color); border-radius: 50%; animation: marah-loading 1.2s linear infinite; }
.brand-loader img { display: block; width: 76px; height: 38px; object-fit: contain; }
@keyframes marah-loading { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand-loader-ring { animation-duration: 3s; } }

/* رمز ربط تيلجرام — يُنسخ حرفياً فيبقى LTR وبخط أحادي المسافة */.compact.brand-loading { min-height: 84px; padding: 6px; }
.compact .brand-loader { width: 72px; height: 72px; }
.compact .brand-loader img { width: 48px; height: 24px; }
/* Message text is copied through the explicit message menu. Horizontal gestures keep vertical scrolling. */
.chat-bubble { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.chat-reply-quote { border-inline-start: 3px solid var(--brand, var(--c-forest-700)); padding: 6px 10px; margin-bottom: 6px; opacity: .85; white-space: pre-wrap; overflow: hidden; max-height: 70px; }
.chat-reply-draft { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-inline-start: 3px solid var(--brand, var(--c-forest-700)); }
.chat-reply-draft[hidden] { display: none; }
.chat-reply-draft span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Compact, translucent cards; swipe upward to browse the lower-half sheets. */
#quick-sheet, #alerts-sheet {
  inset-inline: 0;
  bottom: 0;
  width: min(100%, 560px);
  max-width: 560px;
  margin-inline: auto;
  max-height: 50vh;
  max-height: 50dvh;
  padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 -12px 48px var(--k-quick-sheet-shadow);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
}
#quick-sheet h2, #alerts-sheet h2 { font-size: 1.15rem; padding: 0 4px 8px; }
#quick-sheet .menu-item { border-radius: 12px; padding: 13px 12px; }
#quick-sheet .sheet-search { border-radius: 16px; background: var(--surface); }
#alerts-sheet .alert-row {
  margin-block: 10px;
  padding: 14px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 3px 12px var(--k-alerts-sheet-alert-row-shadow);
}
#alerts-sheet .alert-group.critical .alert-row { border-inline-start: 4px solid var(--danger); }
#alerts-sheet .alert-group-label { padding-inline: 5px; }
#broadcasts .banner {
  margin: 10px 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 3px 12px var(--k-broadcasts-banner-shadow);
}
.toast {
  border-radius: 20px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--ink);
  box-shadow: 0 8px 32px var(--k-toast-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.toast.bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* Immersive live room: camera, speech seats and chat share one stage. */
body:has(.live-room) { overflow: hidden; }
.live-room { position: fixed; inset: 0; z-index: 80; background: var(--video-bg); color: var(--c-white); height: 100dvh; }
.live-room .stream-stage { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; background: var(--video-bg); }
.live-room .stream-media-host { position: absolute; inset: 0; }
.live-room .agora-videos { display: block; position: absolute; inset: 0; height: 100%; }
.live-room .agora-tile { position: absolute; inset: 0; min-height: 0 !important; height: 100%; width: 100%; }
.live-room .agora-tile video { object-fit: cover !important; }
.live-room .agora-guest-video { inset: 100px 14px auto auto; width: 88px; height: 120px; border-radius: 18px; overflow: hidden; z-index: 3; }
.live-room .stream-media-host > p { position: absolute; top: 80px; left: 14px; padding: 0; max-width: 70%; z-index: 2; font-size: .8rem; text-shadow: 0 1px 4px var(--video-bg); }
.live-room .stream-media-host > button { position: absolute; top: 115px; left: 14px; z-index: 4; width: auto; }
.live-room .stream-media-host > button[disabled] { display: none; }
.live-room button { min-height: 44px; border: 1px solid var(--c-white-a12); border-radius: 999px; background: var(--c-black-a70); color: var(--c-white); }
.live-topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: linear-gradient(var(--c-black-a70), transparent); }
.live-host-label { margin-right: auto; min-width: 0; display: grid; gap: 2px; text-align: start; }
.live-host-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 45vw; }
.live-host-label span { font-size: .75rem; color: var(--c-sos); }
.live-topbar button { padding: 7px 12px; flex: 0 0 auto; }
.live-room .stream-canvas-badge { display: inline; position: static; padding: 0; background: transparent; border: 0; }
.live-guest-rail { position: absolute; right: 12px; top: calc(96px + env(safe-area-inset-top)); z-index: 4; display: flex; flex-direction: column; gap: 12px; max-height: 45%; overflow-y: auto; }
.live-guest-seat { width: 78px; padding: 8px 3px; display: grid; justify-items: center; gap: 4px; border-radius: 20px; background: var(--c-black-a70); text-align: center; }
.live-guest-seat strong { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
.live-guest-seat > span:last-child { font-size: .65rem; }
.live-guest-seat.is-speaking .profile-avatar { outline: 3px solid var(--c-ok); box-shadow: 0 0 14px var(--c-ok-a14); }
.live-room .stream-chat-overlay { bottom: calc(8px + env(safe-area-inset-bottom)); padding: 10px 14px; padding-top: 40px; }
.live-room .stream-chat-log { height: min(28dvh, 220px); width: calc(100% - 90px); max-width: 600px; }
.live-room .stream-chat-composer { padding-right: 140px; margin-top: 14px; }
.live-room .stream-chat-composer input { border-radius: 999px; }
.live-actions { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); right: 12px; z-index: 6; display: flex; gap: 6px; }
.live-actions button { padding-inline: 10px; font-size: .78rem; }
.stream-media-controls { position: absolute; bottom: calc(78px + env(safe-area-inset-bottom)); left: 14px; z-index: 6; display: flex; gap: 8px; }
.stream-media-controls[hidden] { display: none; }
.stream-media-controls button { width: 44px; padding: 6px; font-size: 1.1rem; }
.stream-media-controls button[aria-pressed="true"] { background: var(--k-stream-media-controls-bg); }
/* غرفة البث: عدّاد المتواجدين، رسالة الانضمام، زر القست الصغير، وأدوات الصوت والكاميرا */
.live-viewers { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 7px 12px; border-radius: 99px; background: var(--c-white-a12); font-weight: 800; font-size: .85rem; font-variant-numeric: tabular-nums; }
.live-viewers svg { width: 18px; height: 18px; }
.live-badge { display: inline-flex !important; align-items: center; gap: 6px; }
.live-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-sos); animation: reel-blink 1.3s ease-in-out infinite; }
.live-topbar button svg { width: 20px; height: 20px; }
.live-topbar button { display: inline-flex; align-items: center; justify-content: center; }
.live-room .live-actions button.live-guest-action { min-height: 40px; padding: 0 16px; font-size: .8rem; display: inline-flex; align-items: center; gap: 6px; }
.live-guest-action svg { width: 16px; height: 16px; }
.live-room .live-actions button.live-guest-action.is-leave { background: var(--c-black-a70); border-color: var(--c-sos-a40); }
.live-guest-seat span svg { width: 12px; height: 12px; vertical-align: -1px; }
.live-guest-seat { width: 84px; }
.live-seat-slot { display: none; position: relative; width: 84px; height: 112px; margin-bottom: 2px; border-radius: 16px; overflow: hidden; background: var(--c-forest-900); }
.live-guest-seat.has-video .live-seat-slot { display: block; }
.live-guest-seat.has-video .profile-avatar { display: none; }
.live-room .live-seat-slot .agora-tile { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; z-index: auto; }
.live-room .live-seat-slot .agora-tile video { object-fit: cover !important; }
.stream-chat-message.is-join { width: fit-content; max-width: 100%; padding: 4px 12px; border-radius: 99px; background: var(--k-stream-chat-message-is-join-bg); font-size: .82rem; animation: live-join 7s ease forwards; }
@keyframes live-join { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
.live-room .stream-media-controls { left: auto; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); flex-direction: column; }
.stream-media-controls button svg { width: 22px; height: 22px; }
.live-panel { position: absolute; z-index: 8; bottom: calc(75px + env(safe-area-inset-bottom)); inset-inline: 10px; margin: auto; max-width: 560px; max-height: 45dvh; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--c-white-a12); border-radius: 24px; padding: 18px; background: var(--c-black-a70); color: var(--c-white); backdrop-filter: blur(20px); }
.live-panel[hidden] { display: none; }
.live-panel .alert-row { color: var(--c-white); background: transparent; flex-wrap: wrap; align-items: center; }
.live-panel .muted { color: var(--c-muted); }
.live-panel h3 { margin-top: 0; }
.live-panel .row-actions { margin-inline-start: auto; }
.live-panel .alert-row .row-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-inline-start: 0; }
.live-room .live-panel .row-actions button { flex: 0 0 auto; min-height: 38px; padding: 0 16px; font-size: .82rem; }

/* ═══ المجتمع — ريلز بملء الشاشة ═══
 * الخلفية داكنة ثابتة بصرف النظر عن المظهر: الفيديو محتوى لا واجهة. الأيقونات من icons.js
 * (خط واحد، لون واحد)، وأحمر الإعجاب والبث وظيفيان لا زخرفيان. شريط التنقّل السفلي يبقى ظاهراً. */
.community-feed { position: relative; width: min(100%, 460px); height: max(480px, calc(100dvh - 180px)); margin-inline: auto; color: var(--c-white); background: var(--video-bg); border-radius: 26px; overflow: hidden; isolation: isolate; }
.community-feed [hidden] { display: none !important; }
.community-feed button { background: none; border: 0; color: var(--c-white); padding: 0; min-height: 0; font: inherit; border-radius: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.community-feed button:focus-visible { outline: 2px solid var(--c-white); outline-offset: 2px; border-radius: 8px; }
.community-reels { height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none; touch-action: pan-y; outline: none; }
.community-reels::-webkit-scrollbar { display: none; }
.community-reels.is-loading:empty::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, var(--video-bg) 30%, var(--c-forest-900) 50%, var(--video-bg) 70%); background-size: 200% 100%; animation: reel-shimmer 1.3s linear infinite; }
.community-reel { position: relative; height: 100%; width: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: var(--video-bg); }

/* وسائط: الرأسي يملأ الشاشة، والأفقي والصور تتوسّط فوق خلفية ضبابية من نفسها */
.reel-backdrop { position: absolute; inset: -40px; background: linear-gradient(160deg, var(--c-forest-800), var(--video-bg) 70%) center / cover; filter: blur(36px) brightness(.55) saturate(1.25); transform: scale(1.08); transition: opacity .35s; }
.community-reel.is-portrait .reel-backdrop { opacity: 0; }
.reel-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s ease; }
.community-reel.is-ready .reel-media { opacity: 1; }
.community-reel.is-portrait .reel-media { object-fit: cover; }
.reel-scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, var(--c-black-a45) 0, transparent 20%), linear-gradient(to top, var(--c-black-a70) 0, var(--c-black-a45) 30%, transparent 55%); }
.reel-tap { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; background: transparent !important; outline-offset: -4px; }

/* حالات: تحميل، خطأ، إيقاف */
.reel-spinner { position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 3px solid var(--c-white-a12); border-top-color: var(--c-white); animation: reel-spin .8s linear infinite; opacity: 0; pointer-events: none; z-index: 2; }
.community-reel:not(.is-ready):not(.is-error):not(.is-live) .reel-spinner, .community-reel.is-buffering .reel-spinner { opacity: 1; }
.reel-retry { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3; padding: 11px 18px !important; border-radius: 99px !important; background: var(--c-black-a70) !important; font-weight: 700; }
.community-reel.is-error .reel-retry { display: block; }
.community-reel.is-error .reel-spinner { opacity: 0; }
.reel-pause-mark, .reel-flash { position: absolute; top: 50%; left: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; display: grid; place-items: center; pointer-events: none; z-index: 2; color: var(--c-white); opacity: 0; }
.reel-pause-mark svg, .reel-flash svg { width: 64px; height: 64px; filter: drop-shadow(0 2px 8px var(--c-black-a45)); }
.community-reel.is-paused .reel-pause-mark { opacity: .9; }
.reel-flash.go { animation: reel-flash .55s ease-out; }
.reel-burst { position: absolute; z-index: 6; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: var(--c-sos); pointer-events: none; animation: reel-burst .9s ease-out forwards; }
.reel-burst svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 12px var(--c-sos-a40)); }
.reel-burst .ui-line { fill: currentColor; stroke: none; }
.reel-progress { position: absolute; z-index: 4; inset-inline: 0; bottom: 0; height: 3px; background: var(--c-white-a12); pointer-events: none; }
.reel-progress i { display: block; height: 100%; width: 0; background: var(--c-white); }

/* الشريط الجانبي: أيقونات عارية بلا أقراص، كتيك توك */
.reel-rail { position: absolute; z-index: 3; inset-inline-end: 6px; bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.reel-avatar { width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--c-white); overflow: hidden; margin-bottom: 4px; box-sizing: border-box; display: grid; place-items: center; background: var(--c-forest-800); box-shadow: 0 2px 10px var(--c-black-a45); }
.reel-btn { display: grid; justify-items: center; gap: 3px; width: 54px; min-height: 0; text-shadow: 0 1px 4px var(--c-black-a70); }
.reel-btn-ic svg { width: 32px; height: 32px; filter: drop-shadow(0 2px 5px var(--c-black-a45)); transition: transform .15s; }
.reel-btn:active .reel-btn-ic svg { transform: scale(.88); }
.reel-btn-n { font-size: .72rem; font-weight: 700; line-height: 1.1; min-height: .8em; }
.reel-btn[aria-pressed="true"] .ui-line { fill: currentColor; }
.reel-btn-heart[aria-pressed="true"] { color: var(--c-sos); }
.reel-btn-heart[aria-pressed="true"] svg { animation: reel-pop .35s ease; }
.reel-btn-bookmark[aria-pressed="true"] { color: var(--c-amber); }
.reel-btn-bookmark[aria-pressed="true"] svg { animation: reel-pop .35s ease; }

/* التعليق التوضيحي */
.reel-caption { position: absolute; z-index: 2; inset-inline-start: 14px; inset-inline-end: 78px; bottom: 22px; display: grid; gap: 6px; text-align: start; pointer-events: none; text-shadow: 0 1px 6px var(--c-black-a70); }
.reel-author { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.reel-chip { font-size: .68rem; font-weight: 700; padding: 2px 9px; border-radius: 99px; color: var(--c-muted); background: var(--c-ok-a14); border: 1px solid var(--c-ok-a14); text-shadow: none; }
.reel-org { font-size: .78rem; opacity: .8; }
.reel-caption h2 { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.5; color: var(--c-white); }
.reel-desc { margin: 0; font-size: .86rem; line-height: 1.55; opacity: .94; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; pointer-events: auto; cursor: pointer; }
.reel-desc.is-open { -webkit-line-clamp: unset; display: block; max-height: 26dvh; overflow-y: auto; }

/* الشريط العلوي */
.reel-top { position: absolute; z-index: 5; top: 0; inset-inline: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; padding: 10px 10px 22px; background: linear-gradient(var(--c-black-a45), transparent); pointer-events: none; }
.reel-top > * { pointer-events: auto; }
.reel-top-side { display: flex; align-items: center; }
.reel-top-side.end { justify-content: flex-end; }
.reel-tabs { display: flex; gap: 2px; }
.reel-tabs button { position: relative; min-height: 44px; min-width: 44px; padding: 8px 12px; font-size: .98rem; font-weight: 700; opacity: .62; text-shadow: 0 1px 5px var(--c-black-a70); transition: opacity .15s; }
.reel-tabs [aria-selected="true"] { opacity: 1; }
.reel-tabs [aria-selected="true"]::after { content: ""; position: absolute; bottom: 1px; left: 50%; width: 22px; height: 3px; margin-left: -11px; border-radius: 2px; background: var(--c-white); }
.reel-live-pill, .reel-add { display: inline-flex; align-items: center; justify-content: center; background: var(--c-white-a12) !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.reel-live-pill { gap: 6px; padding: 7px 13px 7px 11px !important; border-radius: 99px !important; font-size: .8rem; font-weight: 800; min-height: 44px; min-width: 44px; }
.reel-live-pill svg { width: 18px; height: 18px; }
.community-feed :is(.reel-live-pill, .reel-add, .reel-tabs button) { min-height: 44px; min-width: 44px; }   /* DP-28 (T-61): يغلب .community-feed button { min-height: 0 } */
.reel-live-pill.has-live { background: var(--c-sos) !important; }
.reel-live-pill.has-live svg { animation: reel-blink 1.4s ease-in-out infinite; }
.reel-add { width: 40px; height: 40px; min-height: 44px; min-width: 44px; border-radius: 13px !important; }
.reel-add svg { width: 22px; height: 22px; }
.reel-mod-label { display: none; }   /* AUD-12 (T-61): تسمية «الإشراف» ظاهرة من 768 فقط (الجوال أيقونة وحدها) */
@media (min-width: 768px) {
  .reel-add.reel-mod { width: auto; padding-inline: 12px; gap: 6px; }
  .reel-mod-label { display: inline; font-size: 13px; font-weight: 600; }
  .reel-top-side.end { gap: 8px; padding-inline-end: 8px; }
  .reel-top-side:not(.end) { padding-inline-start: 8px; }
}
/* زر النشر الواضح: خلفية صلبة بتباين عالٍ، هدف لمس 48px، يقرأ فوق الفيديو الساطع */
.reel-add.reel-add-solid { width: 48px; height: 48px; min-width: 48px; border-radius: 16px !important; background: var(--c-white) !important; color: var(--c-forest-700); box-shadow: 0 2px 10px var(--c-black-a45), 0 0 0 2px var(--c-black-a20); backdrop-filter: none; -webkit-backdrop-filter: none; }
.reel-add.reel-add-solid svg { width: 26px; height: 26px; stroke-width: 2.4; }
.reel-top { padding-top: max(10px, env(safe-area-inset-top)); padding-inline: max(10px, env(safe-area-inset-left), env(safe-area-inset-right)); }
.reel-top-side.end { gap: 8px; }
.reel-top { grid-template-columns: auto minmax(0, 1fr) auto; }
.reel-tabs { justify-content: center; min-width: 0; }
@media (min-width: 768px) {   /* AUD-24 (T-61): تبويبات المجتمع في صف مستقل تحت «مباشر» و«الإشراف»/«+» */
  .reel-top { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "live . side" "tabs tabs tabs"; row-gap: 8px; }
  .reel-top > .reel-top-side:not(.end) { grid-area: live; }
  .reel-top > .reel-top-side.end { grid-area: side; }
  .reel-top > .reel-tabs { grid-area: tabs; justify-content: center; gap: 8px; }
}
@media (max-width: 440px) {
  .reel-top { gap: 2px; }
  .reel-tabs button { padding: 8px 7px; font-size: .86rem; }
  .reel-live-pill { width: 40px; height: 40px; padding: 0 !important; border-radius: 13px !important; }
  .reel-live-pill span { display: none; }
  .reel-top-side.end { gap: 4px; }
}
.community-add-fab { position: fixed; z-index: 30; inset-inline-end: max(16px, env(safe-area-inset-right)); bottom: calc(var(--bar, 64px) + 16px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary, var(--c-ok)); color: var(--c-white); box-shadow: 0 4px 16px var(--c-black-a45); }
.community-add-fab svg { width: 28px; height: 28px; stroke-width: 2.4; }

.reel-undo { position: absolute; z-index: 7; inset-inline: 14px; bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-radius: 14px; background: var(--c-forest-800); font-size: .88rem; box-shadow: 0 8px 24px var(--c-black-a45); }
.reel-undo button { color: var(--c-muted); font-weight: 800; padding: 4px 8px; }

.reel-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 90px 30px 60px; text-align: center; }
.reel-empty-ic { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--c-white-a06); color: var(--c-muted); margin-bottom: 4px; }
.reel-empty-ic svg { width: 36px; height: 36px; }
.reel-empty h3 { margin: 0; font-size: 1.15rem; color: var(--c-white); }
.reel-empty p { margin: 0; max-width: 28ch; color: var(--c-white-a50); line-height: 1.6; }
.reel-empty .primary { margin-top: 10px; padding: 12px 24px !important; border-radius: 99px !important; background: var(--c-ok) !important; color: var(--c-forest-800) !important; font-weight: 800; }

/* شريحة بث مباشر */
.reel-live-bg { position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 28%, var(--c-forest-700) 0%, var(--c-forest-900) 48%, var(--video-bg) 100%); }
.reel-live-body { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 90px 28px 100px; text-align: center; }
.reel-live-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 99px; background: var(--c-sos); font-weight: 800; font-size: .85rem; }
.reel-live-badge b { width: 8px; height: 8px; border-radius: 50%; background: var(--c-white); animation: reel-blink 1.2s ease-in-out infinite; }
.reel-live-avatar { position: relative; width: 96px; height: 96px; margin: 22px 0 8px; display: grid; place-items: center; }
.reel-live-avatar i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--c-ok-a14); animation: reel-ring 2.7s ease-out infinite; }
.reel-live-avatar i:nth-child(2) { animation-delay: .9s; }
.reel-live-avatar i:nth-child(3) { animation-delay: 1.8s; }
.reel-live-avatar .profile-avatar { position: relative; border: 3px solid var(--c-white); box-sizing: border-box; }
.reel-live-body h2 { margin: 0; font-size: 1.5rem; color: var(--c-white); }
.reel-live-note { margin: 0; max-width: 30ch; color: var(--c-white-a50); line-height: 1.6; }
.reel-live-join { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; padding: 14px 30px !important; border-radius: 99px !important; background: var(--c-ok) !important; color: var(--c-forest-800) !important; font-weight: 800; font-size: 1.05rem; box-shadow: 0 8px 28px var(--c-ok-a14); }
.reel-live-join svg { width: 22px; height: 22px; }
.reel-live-next { position: absolute; z-index: 2; bottom: 22px; inset-inline: 0; display: grid; justify-items: center; gap: 2px; font-size: .78rem; color: var(--c-white-a50); pointer-events: none; animation: reel-nudge 1.9s ease-in-out infinite; }
.reel-live-next svg { width: 22px; height: 22px; }
.community-reel.is-ended .reel-live-badge { background: var(--c-forest-700); }
.community-reel.is-ended .reel-live-badge b { animation: none; }
.community-reel.is-ended .reel-live-join { display: none; }
.community-reel.is-ended .reel-live-note::after { content: " — انتهى البث"; }

/* ورقة التعليقات (تيك توك): تتبع سمة التطبيق فاتحةً أو داكنة، والفيديو يبقى ظاهراً أعلاها */
.reel-sheet-scrim { position: absolute; inset: 0; z-index: 8; background: transparent; transition: background .2s; }
.reel-sheet-scrim.is-open { background: var(--c-black-a45); }
.reel-sheet { position: absolute; z-index: 9; inset-inline: 0; bottom: 0; height: 72%; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-radius: 18px 18px 0 0; transform: translateY(100%); transition: transform .22s ease; box-shadow: 0 -10px 40px var(--c-black-a45); text-align: start; }
.reel-sheet.is-open { transform: none; }
.reel-sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 12px 10px; }
.reel-sheet-head h3 { margin: 0; font-size: .98rem; font-weight: 800; color: var(--ink); }
.community-feed .reel-sheet button { color: var(--ink); }
.reel-sheet-close { justify-self: end; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50% !important; }
.reel-sheet-close svg { width: 22px; height: 22px; }
.reel-sheet-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 2px 16px 12px; }
.rc-note { margin: 0; padding: 48px 0; text-align: center; color: var(--muted); }
.rc-thread { padding: 10px 0; }
.rc { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.rc .profile-avatar { margin-top: 2px; }
.rc-body { min-width: 0; }
.rc-name { font-size: .8rem; font-weight: 700; color: var(--muted); }
.rc-text { margin: 2px 0 6px; font-size: 1.02rem; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.rc.is-reply .rc-text { font-size: .95rem; }
.rc-meta { display: flex; align-items: center; gap: 16px; font-size: .78rem; color: var(--muted); }
.community-feed .rc-reply { color: var(--muted); font-weight: 700; }
.community-feed .rc-like { display: grid; justify-items: center; gap: 2px; width: 40px; padding-top: 6px; color: var(--muted); font-size: .74rem; }
.rc-like svg { width: 22px; height: 22px; }
.rc-like span:empty { display: none; }
.community-feed .rc-like[aria-pressed="true"] { color: var(--c-sos); }
.rc-like[aria-pressed="true"] .ui-line { fill: currentColor; }
.rc.is-reply { margin-top: 12px; }
.rc-replies { margin-inline-start: 50px; }
.community-feed .rc-more { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.rc-more i { width: 26px; height: 1px; background: var(--line); }
.rc-more svg { width: 14px; height: 14px; }
.reel-sheet-foot { border-top: 1px solid var(--line); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); }
.rc-emojis { display: flex; justify-content: space-between; padding: 2px 2px 10px; }
.community-feed .rc-emojis button { font-size: 1.7rem; line-height: 1; padding: 4px 6px; }
.rc-replying { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px 8px; color: var(--muted); font-size: .8rem; }
.rc-replying svg { width: 16px; height: 16px; }
.rc-compose { display: flex; align-items: center; gap: 10px; }
.rc-pill { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; background: var(--surface-2); border-radius: 99px; min-height: 46px; }
.community-feed .rc-pill input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; color: var(--ink); font: inherit; font-size: .95rem; outline: none; box-shadow: none !important; padding: 8px 4px; }
.rc-pill input::placeholder { color: var(--muted); }
.community-feed .rc-at { width: 36px; height: 36px; display: grid; place-items: center; color: var(--ink); }
.rc-at svg { width: 24px; height: 24px; }
.community-feed .rc-send { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: var(--primary-ink); }
.rc-send svg { width: 18px; height: 18px; }

/* الكاميرا بملء الشاشة (تيك توك): فوق كل شيء بما فيه الشريط السفلي */
.rec-overlay { position: fixed; inset: 0; z-index: 3000; background: var(--c-black); color: var(--c-white); overflow: hidden; touch-action: none; }
.rec-overlay [hidden] { display: none !important; }
.rec-overlay button { background: none; border: 0; color: var(--c-white); padding: 0; min-height: 0; font: inherit; cursor: pointer; border-radius: 0; -webkit-tap-highlight-color: transparent; }
.rec-overlay button:focus-visible { outline: 2px solid var(--c-white); outline-offset: 3px; }
.rec-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--c-black); }
.rec-overlay[data-live="true"][data-facing="user"] video.rec-media { transform: scaleX(-1); }
.rec-scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--k-rec-scrim-bg-1), transparent 22%, transparent 60%, var(--c-black-a70)); }
.rec-progress { position: absolute; z-index: 3; top: env(safe-area-inset-top); inset-inline: 0; height: 4px; background: var(--k-rec-progress-bg); }
.rec-progress i { display: block; height: 100%; width: 0; background: var(--k-rec-progress-bg-v2); }
.rec-top { position: absolute; z-index: 2; inset-inline: 0; top: 0; display: flex; align-items: center; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top)) 14px 0; }
.rec-top .rec-round { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--c-black-a45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rec-round svg { width: 24px; height: 24px; }
.rec-round:disabled { opacity: .35; }
.rec-timer { display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 99px; background: var(--k-rec-timer-bg); font-weight: 700; font-size: .9rem; font-variant-numeric: tabular-nums; direction: ltr; }
.rec-timer::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--k-rec-timer-bg-v2); animation: reel-blink 1s ease-in-out infinite; }
.rec-timer.is-ending { background: var(--k-rec-timer-is-ending-bg); }
.rec-bottom { position: absolute; z-index: 2; inset-inline: 0; bottom: 0; padding: 0 22px calc(28px + env(safe-area-inset-bottom)); display: grid; gap: 14px; justify-items: center; }
.rec-hint { margin: 0; font-size: .85rem; opacity: .9; text-shadow: 0 1px 4px var(--c-black-a70); }
.rec-controls { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.rec-overlay[data-mode="ready"] .rec-controls { grid-template-columns: 1fr 1fr; }
.rec-overlay .rec-shutter { width: 80px; height: 80px; border: 5px solid var(--c-white); border-radius: 50%; display: grid; place-items: center; justify-self: center; }
.rec-shutter span { width: 58px; height: 58px; border-radius: 50%; background: var(--k-rec-shutter-bg); transition: all .2s; }
.rec-shutter.is-recording span { width: 30px; height: 30px; border-radius: 8px; }
.rec-side { display: grid; justify-items: center; gap: 4px; justify-self: start; font-size: .78rem; font-weight: 700; text-shadow: 0 1px 4px var(--c-black-a70); }
.rec-side svg { width: 30px; height: 30px; filter: drop-shadow(0 1px 4px var(--k-rec-side-filter)); }
.rec-overlay .rec-pill { padding: 15px 20px; border-radius: 99px; background: var(--k-rec-overlay-rec-pill-bg); font-weight: 800; font-size: 1.02rem; width: 100%; backdrop-filter: blur(8px); }
.rec-overlay .rec-pill.is-primary { background: var(--k-rec-pill-is-primary-bg); color: var(--k-rec-pill-is-primary-ink); }
.rec-message { position: absolute; z-index: 4; inset-inline: 18px; top: 42%; margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--k-rec-message-bg); text-align: center; line-height: 1.7; }

/* تفاصيل المنشور بعد «التالي» */
.post-details { display: flex; gap: 14px; align-items: flex-start; margin: 8px 0 12px; }
.post-thumb { width: 92px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; background: var(--k-post-thumb-bg); flex-shrink: 0; }
.post-fields { flex: 1; min-width: 0; display: grid; gap: 8px; }

/* تأكيد حذف المنشور */
.reel-confirm { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: var(--c-black-a45); }
.reel-confirm-card { width: min(100%, 320px); display: grid; gap: 10px; padding: 22px 20px 18px; border-radius: 18px; background: var(--surface); color: var(--ink); text-align: center; box-shadow: 0 18px 50px var(--c-black-a45); }
.reel-confirm-card h3 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.reel-confirm-card p { margin: 0; color: var(--muted); line-height: 1.6; font-size: .9rem; }
.reel-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.community-feed .reel-confirm-ok { padding: 12px; border-radius: 12px; background: var(--danger); color: var(--c-white); font-weight: 800; }
.community-feed .reel-confirm-no { padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink); font-weight: 700; }

#settings-gear { padding: 3px; border-radius: 999px; }
@keyframes reel-spin { to { transform: rotate(360deg); } }
@keyframes reel-shimmer { to { background-position: -200% 0; } }
@keyframes reel-flash { 0% { opacity: .95; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.25); } }
@keyframes reel-burst { 0% { opacity: 1; transform: scale(.3) rotate(var(--tilt, 0deg)); } 40% { opacity: 1; transform: scale(1.15) rotate(var(--tilt, 0deg)); } 100% { opacity: 0; transform: scale(1.4) translateY(-46px) rotate(var(--tilt, 0deg)); } }
@keyframes reel-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes reel-blink { 50% { opacity: .35; } }
@keyframes reel-ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes reel-nudge { 50% { transform: translateY(-6px); } }
@media (max-width: 860px) {
  body:has(.community-feed) { overflow: hidden; }
  body:has(.community-feed) #fab { display: none !important; }
  .community-feed { position: fixed; z-index: 6; top: var(--feed-top, var(--topbar-height)); left: 0; right: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom)); width: 100%; height: auto; margin: 0; border-radius: 0; }
}
@media (max-height: 740px) {
  .reel-rail { gap: 8px; bottom: 16px; }
  .reel-btn-ic svg { width: 28px; height: 28px; }
  .reel-avatar { width: 42px; height: 42px; }
}
@media (max-height: 620px) { .reel-avatar { display: none; } .reel-btn-n:not(:empty) { font-size: .66rem; } }
@media (prefers-reduced-motion: reduce) {
  .community-reels { scroll-behavior: auto; }
  .reel-live-avatar i, .reel-live-next, .reel-spinner, .reel-live-badge b { animation: none; }
}

/* ═══ سجّل عمل اليوم: مستطيلات صغيرة، الأيقونة بجانب الاسم (لا فوقه) ═══ */
.dashboard-daily-actions .operation-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; overflow: visible; scroll-snap-type: none; }
.dashboard-daily-actions .operation-shortcuts .daily-action { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; flex: initial; min-height: 52px; padding: 8px 12px; border-radius: 14px; text-align: start; font-size: .9rem; font-weight: 700; }
.dashboard-daily-actions .daily-action .daily-action-symbol { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; }
.dashboard-daily-actions .daily-action .ui-icon { width: 21px; height: 21px; }
.dashboard-daily-actions .dashboard-section-heading { margin-bottom: 10px; }

/* شريط التراجع الصغير بعدّاد تنازلي */
.undo-toast { position: fixed; z-index: 60; inset-inline-start: 14px; bottom: calc(var(--bar) + 14px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; padding: 5px 6px 5px 14px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 74%, transparent); color: var(--bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: .82rem; box-shadow: 0 6px 20px var(--k-undo-toast-shadow); animation: undo-in .2s ease; }
.undo-ring { position: relative; flex: 0 0 auto; width: 26px; height: 26px; display: grid; place-items: center; }
.undo-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.undo-ring circle { fill: none; stroke: currentColor; stroke-width: 2; }
.undo-track { opacity: .25; }
.undo-arc { stroke-dasharray: 50.27; stroke-dashoffset: 0; }
.undo-run { animation: undo-arc linear forwards; }
.undo-count { font-size: .7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.undo-btn { padding: 7px 14px; border: 0; border-radius: 99px; background: color-mix(in srgb, var(--bg) 24%, transparent); color: inherit; font: inherit; font-weight: 800; font-size: .8rem; cursor: pointer; min-height: 0; }
@keyframes undo-arc { to { stroke-dashoffset: 50.27; } }
@keyframes undo-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .undo-run { animation: none; } .undo-toast { animation: none; } }
/* عدد فردي من المستطيلات: الأخير يملأ العرض بدل أن يبقى نصف صف */
.dashboard-daily-actions .operation-shortcuts .daily-action:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* اختيار نوع الحساب عند التسجيل */
.account-types { display: grid; gap: 10px; margin: 14px 0 8px; }
.account-type-card { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: start; cursor: pointer; min-height: 0; font: inherit; }
.account-type-card:hover, .account-type-card:focus-visible { border-color: var(--primary); }
.account-type-icon { flex: 0 0 auto; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.account-type-icon svg { width: 26px; height: 26px; }
.account-type-copy { display: grid; gap: 3px; min-width: 0; }
.account-type-copy strong { font-size: 1rem; }
.account-type-copy small { color: var(--muted); font-size: .8rem; line-height: 1.5; }

/* ═══ نافذة التسجيل المنبثقة ═══ */
.modal-backdrop:has(.record-sheet) { align-items: flex-end; padding: 0; }
.record-sheet { max-width: 560px; width: 100%; max-height: 92dvh; padding: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: 22px 22px 0 0; border-bottom: 0; }
.record-sheet-top { position: relative; flex: 0 0 auto; display: flex; justify-content: center; padding: 8px 12px 2px; min-height: 40px; }
.record-sheet-top .sheet-handle { margin: 4px auto 0; }
.record-sheet-close { position: absolute; top: 6px; inset-inline-start: 10px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink); border: 0; padding: 0; min-height: 0; cursor: pointer; }
.record-sheet-close svg { width: 20px; height: 20px; }
.record-sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(14px + env(safe-area-inset-bottom)); }
.record-sheet .card { border: 0; box-shadow: none; background: transparent; padding: 0; margin: 0; }
.record-sheet .record-head { padding-top: 2px; }
/* زر الحفظ ثابت أسفل النافذة مهما طال النموذج */
.record-sheet form .primary[type="submit"] { position: sticky; bottom: 0; z-index: 2; width: 100%; margin-top: 14px; box-shadow: 0 -12px 14px 4px var(--surface); }
body.record-open #fab { display: none !important; }
body.record-open .sheet-backdrop { z-index: 95; }
body.record-open .sheet { z-index: 96; }
@media (min-width: 861px) {
  .modal-backdrop:has(.record-sheet) { align-items: center; padding: 24px; }
  /* ورقة مركزية: 92dvh + حشوة الخلفية (48px) كانت تتجاوز الارتفاع القصير (جوال أفقي) فيُقصّ رأسها أو زرّ الحفظ */
  .record-sheet { border-radius: 22px; border-bottom: 1px solid var(--line); max-height: min(92dvh, calc(100dvh - 48px)); }
  /* الزر العائم «+ تسجيل» كان للجوال فقط، فلم يبقَ للشاشة الكبيرة مدخل لورقة التسجيل بعد حذف «كل العمليات» */
  .fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 40; padding: 12px 22px; border-radius: 99px; background: var(--primary); color: var(--primary-ink); border: 0; box-shadow: 0 8px 24px var(--k-fab-shadow); cursor: pointer; font: inherit; font-weight: 700; }
  .fab svg { width: 20px; height: 20px; }
}

/* صفّ «كان مطويّاً» يفتح نافذة */
.disclose-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 16px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-align: start; font: inherit; cursor: pointer; min-height: 0; }
.disclose-row:hover, .disclose-row:focus-visible { border-color: var(--primary); }
.disclose-row-copy { display: grid; gap: 3px; min-width: 0; }
.disclose-row-copy strong { font-size: .98rem; color: var(--primary); }
.disclose-row-copy small { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.disclose-row-go { flex: 0 0 auto; color: var(--muted); font-size: 1.3rem; }
/* ترويسة موحَّدة لكل ورقة/نافذة معنونة: عنوان محاذٍ للبداية بحجم رأس نماذج التسجيل (.record-head) وخط فاصل تحته؛ كان للمعنونة
 * عنوان مركزي بلا فاصل (استعارة العلف وغيرها) ولنماذج التسجيل رأس مختلف في المكوّن نفسه. حشوة البداية تُبقي العنوان بعيداً عن زرّ الإغلاق. */
.record-sheet-top .popup-title { flex: 1 1 100%; align-self: stretch; font-size: 1.08rem; padding: 10px 56px 11px; text-align: start; border-bottom: 1px solid var(--line); }
.record-sheet-top { flex-wrap: wrap; }
.record-sheet-top .sheet-handle { flex: 0 0 100%; }

/* ═══ التحصين في القطيع ═══ */
.vacc-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 12px 0; }
.vacc-actions .primary, .vacc-actions .ghost { min-height: 46px; }
.vacc-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.vacc-chip { display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; min-height: 0; }
.vacc-chip strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.vacc-chip span { font-size: .75rem; color: var(--muted); }
.vacc-chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.vacc-chip.is-overdue strong { color: var(--danger); }
.vacc-chip.is-due strong { color: var(--warn); }
.vacc-chip.is-soon strong { color: var(--warn); }
.vacc-list { display: grid; gap: 8px; margin: 12px 0; }
.vacc-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.vacc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.vacc-row.is-overdue .vacc-dot { background: var(--danger); }
.vacc-row.is-due .vacc-dot { background: var(--warn); }
.vacc-row.is-soon .vacc-dot { background: var(--warn); }
.vacc-row.is-ok .vacc-dot { background: var(--primary); }
.vacc-copy { display: grid; gap: 2px; min-width: 0; }
.vacc-copy strong, .vacc-copy .linkish { font-size: .95rem; text-align: start; }
.vacc-copy small { color: var(--muted); font-size: .78rem; }
.vacc-state { font-size: .78rem; font-weight: 700; color: var(--muted); }
.vacc-row.is-overdue .vacc-state { color: var(--danger); }
.vacc-row.is-due .vacc-state { color: var(--warn); }
.vacc-row .small { min-height: 36px; padding: 0 14px; }
@media (max-width: 420px) { .vacc-row { grid-template-columns: auto 1fr auto; } }

/* نافذة جدول اللقاحات: صف مضغوط لكل لقاح */
.vs-rows { display: grid; gap: 8px; margin: 10px 0; }
.vs-row { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.vs-name { font-size: .98rem; }
.vs-edit { display: flex; align-items: center; gap: 8px; }
.vs-days { width: 72px; min-height: 36px; text-align: center; }
.vs-edit .small { min-height: 36px; padding: 0 12px; white-space: nowrap; }
.vs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vs-status { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 12px; border: 1px solid var(--k-vs-status-line); border-radius: 99px; background: var(--k-vs-status-bg); color: var(--k-vs-status-ink); font-size: .78rem; font-weight: 700; cursor: pointer; }
.vs-status:hover { background: var(--k-vs-status-bg-v2); }
.vs-status svg { width: 14px; height: 14px; }
.vs-chip { font-size: .8rem; padding: 3px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--ink, var(--k-vs-chip-ink)); }
.vs-edit-cats { flex: none; width: 34px; height: 34px; min-height: 34px; padding: 0; display: inline-grid; place-items: center; border: 1.5px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink, var(--k-vs-edit-cats-ink)); cursor: pointer; }
.vs-edit-cats svg { width: 15px; height: 15px; }
.vs-edit > svg { flex: none; width: 18px; height: 18px; color: var(--muted, var(--k-vs-edit-ink)); }
.vs-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.vs-stepper .vs-days { width: 52px; min-height: 32px; height: 32px; padding: 0; border: 0; border-radius: 0; background: transparent; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.vs-stepper .vs-days::-webkit-outer-spin-button, .vs-stepper .vs-days::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vs-step { flex: none; width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted, var(--k-vs-step-ink)); cursor: pointer; }
.vs-step:hover { color: var(--ink, var(--k-vs-step-ink-v2)); }
.vs-step svg { width: 14px; height: 14px; }
.vs-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vs-actions .small { width: auto; flex: none; min-height: 36px; padding: 0 16px; white-space: nowrap; }
.vs-tag { font-size: .72rem; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); }
.vs-add { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.vs-add h3 { margin: 0 0 4px; }
.vs-hidden { margin: 10px 0; }

/* تبويبات القطيع: صف واحد بتمرير أفقي بدل التفاف التكاثر وحده في سطر */
.herd-section-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.herd-section-tabs::-webkit-scrollbar { display: none; }
.herd-section-tabs button { flex: 1 0 auto; white-space: nowrap; }

/* الفريق: صف مضغوط لكل عضو + نافذة صلاحياته */
.team-member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.team-member-row:last-child { border-bottom: 0; }
.team-member-copy { flex: 1; display: grid; gap: 2px; min-width: 0; }
.team-member-copy small { color: var(--muted); }
.team-member-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.team-member-popup .perm-section { margin: 12px 0; }
.team-member-popup .perm-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.team-member-popup .perm-grid label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.team-member-popup .team-save { position: sticky; bottom: 0; z-index: 2; width: 100%; margin: 12px 0; box-shadow: 0 -12px 14px 4px var(--surface); }
.team-member-popup .danger { width: 100%; margin-top: 16px; }
@media (min-width: 700px) { .team-member-popup .perm-grid { grid-template-columns: 1fr 1fr; } }

/* الترحيب سطر مضغوط، وزر الطوارئ صغير بجانبه *//* بحث السوق: حقل واحد + زرّ تصفية */
.market-search-row { display: flex; gap: 8px; align-items: center; }
.market-search-row .market-search { flex: 1; min-width: 0; }
.market-filter-button { flex: 0 0 auto; min-height: 44px; }

/* درج دليل الرعاية يُفتح من داخل نافذة منبثقة، فيعلوها */
.drawer-backdrop { z-index: 90; }
.drawer { z-index: 91; }

/* Language controls are available to every role; script shaping uses native fonts. */
.language-select { max-width: 140px; padding: 6px 10px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
#login-form > .language-select { align-self: flex-end; margin-inline-start: auto; }
html[lang="ur"] body { font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; line-height: 1.8; }
html[lang="am"] body { font-family: "Noto Sans Ethiopic", "Nyala", "Segoe UI", sans-serif; }
html[lang="bn"] body { font-family: "Noto Sans Bengali", "Nirmala UI", system-ui, sans-serif; }
html[lang="hi"] body { font-family: "Noto Sans Devanagari", "Nirmala UI", system-ui, sans-serif; }
html[dir="ltr"] .row-meta { direction: ltr; }
@media(max-width: 480px) { .topbar > .language-select { max-width: 90px; font-size: 12px; padding: 4px; } }

html[dir="ltr"] .herd-category-strip { direction: ltr; }
html[dir="ltr"] .ui-icon[data-icon="back"] { transform: scaleX(-1); }
.oauth-buttons { display:grid;gap:10px;margin-block:16px; }
.oauth-buttons button { min-height:48px; }

/* ── إدخال رمز التحقق: ست خانات تُرسم فوق حقل واحد شفاف (otpInput في core.js) ── */
.otp-screen { text-align: center; }
.otp-email-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-bottom: 22px; }
.otp-email { direction: ltr; unicode-bidi: isolate; font-weight: 700; overflow-wrap: anywhere; }
.otp-change { padding: 4px 14px; border: 0; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .88rem; font-weight: 700; }
.otp-change:focus-visible, .otp-resend:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.otp-edit { margin-bottom: 18px; text-align: start; }
.otp-field { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 360px; margin: 0 auto 20px; }
.otp-box { display: flex; align-items: center; justify-content: center; min-height: 56px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; transition: border-color .12s, box-shadow .12s; }
.otp-box.filled { border-color: var(--primary); }
.otp-box.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.otp-native { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; font-size: 16px; }
.otp-resend { padding: 6px 4px; border: 0; background: none; color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.otp-resend:disabled { opacity: .5; cursor: not-allowed; }
.otp-tip { display: flex; align-items: center; gap: 10px; margin: 22px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--ink); text-align: start; font-size: .9rem; }
.otp-tip .ui-icon { flex: none; color: var(--primary); }
.otp-screen .error { margin: 0 0 12px; }
@media (prefers-reduced-motion: reduce) { .otp-box { transition: none; } }

/* ── شرائح أيام تنبيه الطقس ──
   الحرارة هي الرقم الكبير، والشدة نقطة ملوّنة مع كلمتها (لا لون وحده)، وثلاث شرائح في سطر واحد.
   في الكرت الرئيسي النقطة وكلمة المستوى الجانبيتان مكرّرتان لما تقوله الشرائح فتُخفيان. */
.weather-days { display: flex; gap: 8px; margin-top: 10px; }
.weather-day { flex: 1 1 0; min-width: 0; display: grid; gap: 2px; justify-items: start; padding: 9px 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); text-align: start; }
.weather-day .wd-name { color: var(--muted); font-size: .74rem; font-weight: 600; }
.weather-day .wd-temp { font-size: 1.25rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.weather-day .wd-hum, .weather-day .wd-peak { color: var(--muted); font-size: .72rem; }
.weather-day .wd-level { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: .72rem; font-weight: 700; }
.weather-day .wd-level::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.weather-day.critical { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.weather-day.critical .wd-level { color: var(--danger); }
.weather-day.warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.weather-day.warning .wd-level { color: var(--warn); }
.group-choice-list { display: flex; flex-wrap: wrap; gap: .5rem; max-height: 14rem; overflow-y: auto; margin-block: .5rem; }
.group-choice-list button { min-height: 44px; flex: 1 1 8rem; white-space: normal; overflow-wrap: anywhere; }
.exit-heads { display: grid; gap: .25rem; margin-block: .5rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius, 12px); background: var(--surface); }
.exit-heads-list { display: grid; gap: .5rem; max-height: 14rem; overflow-y: auto; }
.exit-heads-lot { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0 .5rem; margin: 0; padding: 0; border: 0; }
.exit-heads-lot legend { grid-column: 1 / -1; padding: 0; font-weight: 600; }
.group-confirmation { margin: 0 0 1rem; }
.group-confirmation-row { display: grid; grid-template-columns: minmax(6rem, .8fr) minmax(0, 1.2fr); gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.group-confirmation dt { color: var(--muted); }
.group-confirmation dd { margin: 0; font-weight: 600; text-align: end; overflow-wrap: anywhere; }

/* ── بطاقة معلومات الحساب: صورة كبيرة قابلة للنقر، وكل معلومة «العنوان: القيمة» في سطر واحد ── */
.profile-sheet { display: grid; gap: 16px; }
.profile-picture { display: grid; justify-items: center; }
.profile-picture-face {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}
.profile-picture.is-busy { opacity: .55; pointer-events: none; }
.profile-picture-badge {
  position: absolute;
  inset-block-end: 2px;
  inset-inline-end: 2px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-ink);
}
.profile-picture-badge svg { width: 18px; height: 18px; }
.profile-picture-actions { display: grid; gap: 10px; margin-top: 4px; }
.profile-picture-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: start;
}
.profile-picture-action svg { width: 22px; height: 22px; flex: 0 0 auto; color: var(--primary); }
.profile-picture-action.is-danger, .profile-picture-action.is-danger svg { color: var(--danger); }
.profile-sheet .profile-fields { grid-template-columns: 1fr; gap: 0; }
.profile-field { display: flex; align-items: baseline; gap: 10px; padding: 11px 0; }
.profile-field:first-child { padding-top: 0; }
.profile-field-label { flex: 0 0 auto; min-width: 7.2rem; color: var(--muted); font-size: .9rem; }
.profile-field-label::after { content: ":"; margin-inline-start: 2px; }
.profile-field-value { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }

/* ── وحدات التعليف (الإعدادات) ── */
.feed-unit-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-unit-row:last-child { border-bottom: 0; }
.feed-unit-row strong { flex: 0 0 auto; }
.feed-unit-row .muted { flex: 1; }
.feed-unit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.feed-unit-form .primary { grid-column: 1 / -1; }

/* ── دليل الرعاية: عناوين بثلاث في الشريحة، تنقّل بالسحب ── */
.care-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-top: 10px; }
.care-track::-webkit-scrollbar { display: none; }
.care-page { flex: 0 0 100%; scroll-snap-align: start; display: grid; gap: 8px; align-content: start; }
.care-page { min-width: 0; }
.care-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; width: 100%; min-height: 56px; padding: 10px 14px; text-align: start; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.care-row-title { font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.care-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.care-nav-mid { display: grid; justify-items: center; gap: 4px; }
.care-dots { display: flex; gap: 6px; }
.care-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.care-dot.active { background: var(--primary); }
.care-guide .care-disclaimer { margin-top: 12px; }

/* تفاصيل دليل الرعاية: ورقة سفلية بثلثي الشاشة (يبقى الشعار ظاهراً) لا لوحة بكامل الصفحة */
.drawer {
  inset-block: auto 0;
  inset-inline: 0;
  margin-inline: auto;
  width: min(560px, 100vw);
  height: 66vh;
  max-height: 66dvh;
  border-inline-start: 0;
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px var(--k-drawer-shadow);
  transform: translateY(100%);
}
.drawer.open { transform: translateY(0); }
@media (max-width: 480px) { .drawer { width: 100vw; } }

/* رقم الرأس لا ينكسر ولا تغطيه الشارة */
.tagged-animal-card strong { white-space: nowrap; }
.tagged-animal-card .pill { max-width: 44vw; white-space: normal; text-align: center; line-height: 1.3; }

/* تبويبات التغذية: بعدد التبويبات الظاهرة فعلاً (اثنان أو ثلاثة) لا ثلاثة أعمدة ثابتة، وأيقونة أصغر */
.feed-section-tabs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.feed-section-tabs button { flex-direction: column; gap: 3px; text-align: center; line-height: 1.25; }
.feed-section-tabs button svg { width: 16px; height: 16px; }
/* أزرار القالب لا تلتصق بنص الملاحظة */
.care-text + .quick-actions { margin-top: 12px; }

/* زر القالب الجاهز: أيقونة صغيرة مع اسمها، بعرض المحتوى *//* بوليش: قيمة النص في بطاقة الإحصاء، وزر مدمج بأيقونة صغيرة واسمها */
.stat .value.value-text { font-size: 1.05rem; line-height: 1.35; }
.compact-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; font-size: .88rem; }
.compact-btn svg { width: 16px; height: 16px; }

/* ورقة اختيار القائمة (بديل قائمة النظام) */
.select-sheet-backdrop { position: fixed; inset: 0; z-index: 200; background: var(--k-select-sheet-backdrop-bg); display: flex; align-items: flex-end; justify-content: center; }
.select-sheet { width: min(560px, 100vw); max-height: 62dvh; display: flex; flex-direction: column; gap: 8px; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); box-shadow: 0 -10px 30px var(--k-select-sheet-shadow); }
.select-sheet .sheet-handle { align-self: center; width: 38px; height: 4px; border-radius: 4px; background: var(--line); }
.select-sheet-title { font-size: .95rem; color: var(--muted); padding: 2px 4px; }
.select-sheet-search { min-height: 40px; }
.select-sheet-list { overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 2px; }
.select-sheet-option { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.select-sheet-option:hover, .select-sheet-option:focus-visible { background: var(--surface-2); }
/* من 861px (عتبة القشرة الواسعة) تُعرض قائمة الاختيار Popover مرتكزاً على الحقل (الموضع من متغيرات يضبطها openSelectSheet) بدل ورقة سفلية
 * بعرض 560px أسفل وسط الشاشة؛ دونها تبقى الورقة السفلية. */
@media (min-width: 861px) {
  .select-sheet-backdrop.is-popover { display: block; background: transparent; }
  .select-sheet-backdrop.is-popover .select-sheet { position: fixed; inset-inline: auto; left: var(--sp-left); top: var(--sp-top, auto); bottom: var(--sp-bottom, auto); width: var(--sp-width); max-height: var(--sp-max); padding: 6px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px var(--c-black-a20); }
  .select-sheet-backdrop.is-popover .sheet-handle, .select-sheet-backdrop.is-popover .select-sheet-title { display: none; }
}
.select-sheet-option[aria-selected="true"] { background: var(--surface-2); font-weight: 700; }
.select-sheet-option svg { width: 16px; height: 16px; color: var(--primary); flex: none; }
/* صفوف القائمة بارتفاع تلقائي: لا ارتفاع ثابت ولا تقلّص، فلا تتراكب الصفوف الطويلة؛ والقائمة تتمرّر داخل الورقة */
.select-sheet-list { min-height: 0; grid-auto-rows: max-content; }
.select-sheet-option { height: auto; flex: none; }
.select-sheet-option.is-rich { min-height: 48px; padding: 12px; border-radius: 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.select-sheet-option.is-rich .ssr-body { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.select-sheet-option.is-rich .ssr-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.select-sheet-option.is-rich .ssr-title { flex: 1 1 auto; min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; line-height: 1.4; }
.select-sheet-option.is-rich .ssr-amount { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.select-sheet-option.is-rich .ssr-meta { font-size: .8rem; line-height: 1.3; color: var(--muted); font-weight: 400; }
.select-sheet-empty { padding: 12px; text-align: center; }
.sources-list { display: grid; gap: 10px; }
.source-item { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.source-link { color: var(--primary); font-size: .85rem; direction: ltr; text-align: start; overflow-wrap: anywhere; }
.sources-btn { margin-top: 14px; }
/* صفّا «كل العمليات» و«التقارير والإدارة» تحت اختصارات التسجيل (كالتطبيق الأصلي، من التعريف المشترك) *//* عنوان الصفحة في الرأس: يظهر في المظهر الحديث وحده (modern.css) */
.topbar-title { display: none; }

/* إجراءات سياقية لكل صفحة (بعد إلغاء «+»): أزرار بحدّ حبر وإشارة + */
.context-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.context-action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--ink, currentColor); background: transparent; color: var(--ink); font: inherit; font-weight: 800;
}
.context-action > span:first-child { font-size: 1.25rem; line-height: 1; }
.context-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.context-actions-grid .context-action { justify-content: flex-start; border-radius: 16px; min-height: 56px; }
.finance-moves { display: grid; gap: 10px; }

/* ذروة حرارة اليوم بجانب أيقونة الإجهاد الحراري *//* زر الإغلاق في النوافذ المنبثقة: مسافة أمان 16px عن الحواف المستديرة */
.record-sheet-close { top: 16px; inset-inline-start: 16px; }

/* تنبيه تفاعلي: نص + زر إجراء مباشر (بدل بطاقة رمادية صامتة) */
.actionable-alert { display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--warn, var(--k-actionable-alert-line)); background: var(--warn-soft, transparent); }
.actionable-alert p { margin: 0; font-weight: 700; }
.actionable-alert .primary { justify-self: start; }

/* الرئيسية: بلاطتان صغيرتان مرتّبتان (رؤوس المراح، وما صُرف اليوم) بلا أيقونات *//* لا شيء عاجل: سطر مختصر *//* الشمس والتقويم مجموعة واحدة بدل رمزين متناثرين *//* مهمة يومية بحالة للقراءة فقط */
.task-readonly { cursor: default; }

/* ── القطيع: ترتيب مدمج (شريط إجمالي، بطاقة دفعة مقروءة، رؤوس بشبكة) ── */
.context-actions-compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.context-actions-compact:has(> :only-child) { grid-template-columns: 1fr; }
.context-actions-compact .context-action { justify-content: center; min-height: 40px; padding: 0 12px; font-size: .9rem; }
.herd-total-card {
  min-height: 0; align-items: center; justify-content: flex-start; gap: 28px;
  margin-bottom: 14px; padding: 14px 18px; border-radius: 18px;
}
.herd-total-card::after { display: none; }
.herd-total-value { margin-top: 2px; font-size: clamp(1.7rem, 7vw, 2.2rem); line-height: 1.05; }
.herd-total-value small { font-size: .8rem; font-weight: 700; letter-spacing: 0; opacity: .75; }
.herd-category-strip { margin: 8px -2px 10px; }
.herd-category-strip button { min-height: 36px; padding: 4px 12px; font-size: .88rem; }
.herd-search { min-height: 44px; margin-bottom: 10px; }
.herd-search::placeholder { color: var(--ink-soft, var(--muted)); opacity: .85; }
.herd-add-lot {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: transparent;
  color: var(--ink); font: inherit; font-size: .84rem; font-weight: 800; white-space: nowrap;
}
.herd-add-lot > span:first-child { font-size: 1.1rem; line-height: 1; }
.herd-browser > .section-heading { flex-wrap: wrap; align-items: center; }
.herd-browser > .section-heading > small { flex: 1 0 100%; overflow-wrap: anywhere; }
.herd-lot-card, .herd-lot-card.has-menu {
  grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding: 14px;
}
.herd-lot-main { grid-column: 1 / -1; gap: 12px; }
.herd-lot-title { flex: 1 1 auto; min-width: 0; }
.herd-lot-title strong { font-size: 1.05rem; }
.herd-lot-main .herd-lot-title small { margin-top: 2px; color: var(--ink); opacity: .7; font-size: .84rem; font-weight: 600; }
.herd-lot-count {
  flex: 0 0 auto; display: flex; align-items: baseline; gap: 4px; padding: 6px 12px;
  border-radius: 999px; background: var(--surface-2); text-align: center;
}
.herd-lot-count strong { display: inline; font-size: 1.15rem; }
.herd-lot-count small { font-size: .78rem; }
.herd-lot-card .herd-lot-meta, .herd-lot-card.has-menu .herd-lot-meta {
  grid-column: 1 / -1; grid-row: auto; min-height: 0; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--line); text-align: start;
}
.herd-lot-meta span, .herd-lot-meta strong { display: inline; }
.herd-lot-meta strong { margin-inline-end: auto; }
.herd-lot-card.has-menu .lot-menu { grid-row: auto; grid-column: auto; align-self: center; justify-self: auto; }
.lot-menu-trigger { width: 36px; height: 36px; min-height: 36px; }
.tagged-animal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tagged-animal-card { min-height: 56px; grid-template-columns: 36px minmax(0, 1fr); padding: 8px 10px; }
.tagged-animal-card .animal-avatar { width: 34px; height: 34px; border-radius: 11px; }
.tagged-animal-card .pill { grid-column: 1 / -1; max-width: none; }
.tagged-animal-list .empty { grid-column: 1 / -1; }
.herd-section-content { padding-bottom: 24px; }

/* رابط الرؤوس المرقّمة في «القطيع» وأيقونة معلومات الرأس في «التحصين» */
.herd-tagged-link {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); font: inherit; text-align: start; cursor: pointer;
}
.herd-tagged-link strong, .herd-tagged-link small { display: block; }
.herd-tagged-link small { margin-top: 2px; color: var(--muted); font-size: .8rem; }
.herd-tagged-link > span:last-child { color: var(--muted); font-size: 1.4rem; }
.herd-browser .tagged-animal-list:empty { display: none; }
.vacc-info {
  flex: 0 0 auto; width: 34px; height: 34px; min-height: 34px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
}
.vacc-info svg { width: 18px; height: 18px; }
.vacc-info:hover, .vacc-info:focus-visible { background: var(--surface-2); }
.vacc-chips { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }

/* ترقيم المربّي الخاص في معالج إضافة المجموعة */
.ear-range { margin: 8px 0 0; padding: 10px 12px 12px; border: 1.5px dashed var(--line); border-radius: 14px; }
.ear-range legend { padding: 0 6px; font-weight: 800; font-size: .9rem; }
.ear-range .row-actions > label { flex: 1 1 0; min-width: 0; }
/* مفتاح مقسوم (aria-pressed): الخيار المفعّل بتعبئة الإجراء الرئيسي (--primary/--primary-ink، تباين AA) والآخر شفاف */
.ear-toggle { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 8px; border: 1.5px solid var(--primary); border-radius: 12px; overflow: hidden; }
.ear-toggle-btn { min-height: 44px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-weight: 700; cursor: pointer; }
.ear-toggle-btn + .ear-toggle-btn { border-inline-start: 1.5px solid var(--primary); }
.ear-toggle-btn.is-on, .ear-toggle-btn[aria-pressed=true] { background: var(--primary); color: var(--primary-ink); font-weight: 800; }
.ear-toggle-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
/* أوراق الدفعة (تصحيح السجلات، العمر والفئة وأدواتها) تتوسط الشاشة بمكان ثابت على الجوال أيضاً */
@media (max-width: 767.98px) {
  html[data-ui] body .modal-backdrop:has(.popup-centered) { align-items: center; padding: 16px; }
  html[data-ui] body .record-sheet.popup-centered { border-radius: 24px; max-height: calc(100dvh - 32px); inset: auto; transform: none; margin: 0; }
}
.ear-free-list { display: grid; gap: 8px; max-height: 40vh; overflow: auto; }
.ear-free-row { display: grid; grid-template-columns: 1fr 9rem; gap: 8px; align-items: center; }
.ear-free-row[hidden], .ear-pane[hidden] { display: none; }

/* فئات اللقاح في جدول اللقاحات */
.vs-cats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 8px; }
.vs-cat-chips { width: 100%; }

/* صف التحصين مدمج بسطرين (لا زرّ تحت كل رأس) + ترقيم صفحات */
.vacc-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 9px 12px; }
.vacc-copy { gap: 1px; }
.vacc-copy .vacc-state { display: block; }
.vacc-tools { display: flex; align-items: center; gap: 8px; }
@media (max-width: 420px) { .vacc-row { grid-template-columns: auto minmax(0, 1fr) auto; } .vacc-state { display: block; } }
.vacc-list { margin: 8px 0; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 16px; }
.pager button { min-width: 88px; }
.pager-page { font-weight: 700; font-size: .85rem; color: var(--muted); }
.pager-info { margin: 6px 2px 0; }

/* ── بطاقة الرأس: رأس مدمج، حقائق في صف، لقاحات بصفوف مضغوطة ── */
.passport-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.passport-tag { font-weight: 800; font-size: 1.05rem; }
.passport-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.passport-facts .stat { padding: 8px 10px; min-width: 0; }
.passport-facts .stat .value { font-size: .95rem; overflow-wrap: anywhere; }
.passport-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.passport-section-head .primary { margin-inline-start: auto; width: auto; padding: 6px 14px; min-height: 0; }
.count-chip { min-width: 24px; padding: 1px 8px; border-radius: 99px; background: var(--line); color: var(--muted); font-size: .8rem; text-align: center; }
.vacc-list { display: flex; flex-direction: column; }
.vacc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; }
.vacc-row + .vacc-row { border-top: 1px solid var(--line); }
.vacc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vacc-row .pill { flex: none; max-width: 48%; white-space: normal; text-align: center; line-height: 1.3; }
.record-sheet .card { padding-top: 14px; }
.record-sheet-body { scrollbar-width: thin; }

/* ── صفحة التشغيل: مؤشرات في صف، خلطات مضغوطة، تبويبات بخلفية صلبة ── */
.feed-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.feed-kpis .stat { padding: 10px 8px; min-width: 0; }
.feed-kpis .stat .label { font-size: .75rem; }   /* DP-28 (T-61): 12px لا أقل */
.feed-kpis .stat .value { font-size: 1.05rem; overflow-wrap: anywhere; }
.feed-kpis .stat .value.value-text { font-size: .9rem; }
.mix-head { display: grid; gap: 8px; }
.mix-cats, .mix-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.mix-chip { padding: 2px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; }
.mix-chip.soft { background: transparent; color: var(--muted); font-weight: 500; }
.feed-section-tabs { background: var(--surface); backdrop-filter: none; }
main { scroll-padding-top: 130px; }
@media (max-width: 700px) {
  table.compact-table { display: table; width: 100%; }
  table.compact-table thead { display: table-header-group; position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  table.compact-table tbody { display: table-row-group; }
  table.compact-table tr { display: table-row; border: 0; padding: 0; margin: 0; background: none; }
  table.compact-table th, table.compact-table tbody td, table.compact-table tbody td.lead {
    display: table-cell; padding: 8px 6px; border: 0; border-top: 0; border-bottom: 1px solid var(--line);
    font-size: .88rem; font-weight: 500; margin: 0; }
  table.compact-table tbody td.lead { font-weight: 700; }
  table.compact-table tbody td::before { content: none; }
  table.compact-table tbody tr:last-child td { border-bottom: 0; }
  table.compact-table th.num, table.compact-table td.num { text-align: end; }
  .feed-workspace { padding-bottom: 28px; }
}

/* السوق: خدمات بصفوف، وشاشات فرعية برأس رجوع (كل المظاهر؛ المظهر الحديث يخصّصها في modern.css) */
.market-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.market-requests-action, .market-refresh {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; font: inherit; cursor: pointer;
}
.market-sub-head { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.market-sub-head h1 { margin: 0; font-size: 1.2rem; }
.market-price-pending { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }

.supplier-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.supplier-head h2 { margin: 0; }

/* ── سوق المنتجات (store_market.js) ── */
.sm-view { padding-bottom: 24px; }
.sm-region { margin-bottom: 8px; }
.sm-tabs { display: flex; gap: 6px; margin: 6px 0 10px; }
.sm-tabs button { flex: 1; padding: 9px; border-radius: 999px; }
.sm-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink, var(--c-white)); border-color: var(--primary); }
.sm-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 10px; }
.sm-bar select { width: auto; min-width: 140px; margin: 0; }
.sm-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .sm-grid { grid-template-columns: repeat(4, 1fr); } }
.sm-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface, var(--c-white)); border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 12px; padding: 8px; }
.sm-card.is-out { opacity: .65; }
.sm-open { display: flex; flex-direction: column; gap: 3px; text-align: start; background: none; border: 0; padding: 0; width: 100%; }
.sm-img { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2, var(--c-gray-eee)); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: var(--muted); }
.sm-img.big { aspect-ratio: 16 / 10; max-height: 240px; margin-bottom: 8px; }
.sm-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sm-badge { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--k-sm-badge-bg); color: var(--c-white); font-size: .75rem; padding: 2px 7px; border-radius: 999px; }
.sm-badge.dark { background: var(--k-sm-badge-dark-bg); inset-inline-start: auto; inset-inline-end: 6px; }
.sm-name { font-size: .92rem; line-height: 1.3; }
.sm-price { font-weight: 700; }
.sm-price.big { font-size: 1.3rem; }
.sm-price s { color: var(--muted); font-weight: 400; font-size: .8rem; margin-inline-start: 6px; }
.sm-meta { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; margin: 2px 0; }
.sm-seller { font-size: .78rem; color: var(--muted); }
.sm-verified { color: var(--primary); font-weight: 700; }
.sm-add { width: 100%; padding: 7px; font-size: .85rem; }
.sm-more { width: 100%; margin: 12px 0; }
.sm-note { background: var(--surface-2, var(--c-gray-eee)); padding: 8px 10px; border-radius: 8px; font-size: .85rem; margin: 8px 0; }
.sm-note.warn { background: var(--k-sm-note-warn-bg); color: var(--k-sm-note-warn-ink); }
.sm-note.bad { background: var(--k-sm-note-bad-bg); color: var(--k-sm-note-bad-ink); }
.sm-line { display: grid; grid-template-columns: 1fr 70px auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line, var(--c-gray-ddd)); }
.sm-line input { margin: 0; }
.sm-sub { display: flex; justify-content: space-between; padding-top: 6px; }
.sm-qty-row { display: flex; gap: 8px; margin: 10px 0; }
.sm-qty-row input { flex: 1; margin: 0; }
.sm-qty-row .primary { width: auto; margin: 0; }
.sm-seller-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
/* بطاقة المتجر كالسوق: غلاف 4:3 من صور منتجاته، اسم، سطر واحد */
.sm-store-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sm-store-card { display: flex; flex-direction: column; gap: 4px; text-align: start; background: var(--surface, var(--c-white)); border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 12px; padding: 8px; min-width: 0; }
.sm-store-cover { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; display: grid; gap: 2px; background: var(--surface-2, var(--c-gray-eee)); }
.sm-store-cover img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 0; }
.sm-store-cover.n1 { grid-template: 1fr / 1fr; }
.sm-store-cover.n2 { grid-template: 1fr / 1fr 1fr; }
.sm-store-cover.n3 { grid-template: 1fr 1fr / 2fr 1fr; }
.sm-store-cover.n3 img:first-child { grid-row: 1 / 3; }
.sm-store-cover .sm-store-initial { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 800; color: var(--c-white); }
.sm-store-name { font-size: .95rem; line-height: 1.3; overflow-wrap: anywhere; }
.sm-store-tag { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .78rem; }
@media (min-width: 720px) { .sm-store-grid { grid-template-columns: repeat(3, 1fr); } }
.sm-shelf-title { margin: 14px 0 6px; font-size: 1rem; }
.sm-shelf { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.sm-shelf .sm-card { flex: 0 0 150px; }
.sm-view a.button { display: inline-block; padding: 9px 14px; border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 9px; text-decoration: none; color: inherit; }

/* ── طلباتي وإتمام الطلب والتقييم ── */
.sm-tabs button { position: relative; }
.sm-dot { position: absolute; top: -4px; inset-inline-end: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--k-sm-dot-bg); color: var(--c-white); font-size: .72rem; line-height: 18px; text-align: center; }
.sm-order { background: var(--surface, var(--c-white)); border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.sm-order.is-new { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.sm-order .order-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.sm-lines { list-style: none; margin: 6px 0; padding: 0; }
.sm-lines li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line, var(--c-gray-ddd)); font-size: .9rem; }
.sm-timeline { list-style: none; margin: 8px 0; padding: 0; padding-inline-start: 10px; border-inline-start: 2px solid var(--line, var(--c-gray-ddd)); display: grid; gap: 3px; font-size: .8rem; }
.sm-timeline li { display: flex; justify-content: space-between; gap: 8px; }
.sm-rated { background: var(--surface-2, var(--c-gray-eee)); border-radius: 8px; padding: 8px 10px; margin: 8px 0; display: grid; gap: 4px; font-size: .9rem; }
.sm-review { background: var(--surface-2, var(--c-gray-eee)); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.sm-review p { margin: 6px 0 0; font-size: .9rem; }
.stars { color: var(--k-stars-ink); letter-spacing: 2px; }
.sm-rate { color: var(--k-sm-rate-ink); font-size: .78rem; }
.sm-rate.big { font-size: 1rem; margin: 6px 0 0; }
.star-pick { display: flex; justify-content: center; gap: 6px; margin: 10px 0 14px; }
.star { background: none; border: 0; font-size: 2.2rem; line-height: 1; color: var(--line, var(--k-star-ink)); padding: 2px 4px; }
.star.on { color: var(--k-star-on-ink); }
.sm-actions { display: flex; gap: 8px; margin-top: 12px; }
.sm-actions button { flex: 1; }
.sm-actions .primary { flex: 1.5; }
.sm-sub.big { font-size: 1.05rem; border-top: 1px solid var(--line, var(--c-gray-ddd)); margin-top: 6px; }
.sm-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: .9rem; }
.sm-check input { width: auto; margin: 0; }
.sm-order .row, .sm-view .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.sm-segmented { display: flex; border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 10px; overflow: hidden; margin: 6px 0 10px; }
.sm-seg { flex: 1; border: 0; border-radius: 0; padding: 10px; background: var(--surface, var(--c-white)); }
.sm-seg.on { background: var(--primary); color: var(--primary-ink, var(--c-white)); }
.record-sheet .field { display: block; margin: 0 0 10px; }
.record-sheet .field > span { display: block; margin-bottom: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.record-sheet .form-grid.always { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.sm-totals { display: grid; gap: 3px; margin: 6px 0; }
.sm-kv { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: .9rem; }
.sm-kv.total { border-top: 1px solid var(--line, var(--c-gray-ddd)); padding-top: 5px; margin-top: 3px; font-size: 1rem; }

/* ── صفوف الشرائح والمرشحات (كانت تُرصّ عمودياً لغياب التنسيق خارج بوابة المتجر) ── */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.chip-row .chip, .sm-filter-row .chip, .sm-region .chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; }
.sm-filter-row { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px 0 8px; margin-bottom: 4px; scrollbar-width: none; scrollbar-color: transparent transparent; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.sm-filter-row::-webkit-scrollbar { display: none; }
.sm-filter-row .chip { flex: 0 0 auto; white-space: nowrap; }
.sm-region { margin-bottom: 6px; }
.sm-region .chip { max-width: 100%; justify-content: flex-start; }
.sm-prices-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.sm-prices-row .ghost.small { padding: 6px 12px; font-size: .85rem; }

/* التبويبات: حدّ رفيع موحّد وتظليل واضح للمحدد */
.sm-tabs { gap: 6px; }
.sm-tabs button { border: 1px solid var(--line, var(--c-gray-ddd)); border-radius: 999px; padding: 9px 6px; background: var(--surface, var(--c-white)); color: var(--ink); font-weight: 600; box-shadow: none; }
.sm-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink, var(--c-white)); border-color: var(--primary); }

/* بطاقة المنتج بلا صورة: مساحة أصغر */
.sm-img.no-photo { aspect-ratio: 16 / 9; font-size: 1.3rem; }
.sm-img.big.no-photo { aspect-ratio: 16 / 7; }
.sm-ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--muted); background: repeating-linear-gradient(135deg, var(--surface-2, var(--c-gray-eee)), var(--surface-2, var(--c-gray-eee)) 10px, transparent 10px, transparent 20px); }
.sm-ph .ui-icon { width: 34px; height: 34px; opacity: .7; }
.sm-ph .ui-tone { display: none; }
.sm-verified { display: inline-flex; vertical-align: middle; color: var(--primary); margin-inline-start: 4px; }
.sm-verified .ui-icon { width: 15px; height: 15px; }

/* السلة في الرأس */
.cart-button .cart-badge { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--k-cart-button-cart-badge-bg); color: var(--c-white); font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center; }
.cart-reminder { display: flex; align-items: center; gap: 8px; margin: 8px 12px 0; padding: 6px 8px 6px 12px; border-radius: 12px; background: var(--primary-soft); border: 1px solid var(--primary); font-size: .88rem; }
.cart-reminder-text { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.cart-reminder button { flex: 0 0 auto; width: auto; margin: 0; white-space: nowrap; }
.cart-reminder-go { padding: 6px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-ink, var(--c-white)); border: 0; font-weight: 600; }
.cart-reminder-x { width: 32px !important; height: 32px; padding: 0; border-radius: 50%; background: transparent; border: 0; font-size: 1.1rem; line-height: 1; }

/* نافذة السلة: الإجمالي والإرسال دائماً ظاهران أسفلها */
.sm-foot { position: sticky; bottom: -1px; margin: 12px -4px -4px; padding: 10px 4px 6px; background: var(--surface, var(--c-white)); border-top: 1px solid var(--line, var(--c-gray-ddd)); display: grid; gap: 8px; z-index: 2; }
.sm-foot .primary { margin: 0; }
.sm-line { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "info total" "step step"; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line, var(--c-gray-ddd)); }
.sm-line-info { grid-area: info; display: grid; gap: 2px; }
.sm-line-total { grid-area: total; }
.sm-stepper { grid-area: step; display: inline-flex; align-items: center; gap: 6px; }
.sm-stepper input { width: 72px; margin: 0; text-align: center; }
.sm-stepper .small { padding: 4px 12px; font-size: 1.1rem; line-height: 1; }

/* منتقي الموقع */
.lp-map { height: 260px; border-radius: 12px; overflow: hidden; background: var(--surface-2, var(--c-gray-eee)); margin-bottom: 8px; }
.lp-here { width: 100%; margin: 0 0 8px; }
.lp-status { margin: 0 0 6px; }
.lp-info { display: grid; gap: 6px; margin: 6px 0 10px; }
.lp-card { display: grid; gap: 6px; background: var(--surface-2, var(--c-gray-eee)); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.record-sheet .chips { display: flex; flex-wrap: wrap; gap: 6px; }

.sm-grid.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* إشعار تحديث التطبيق */
.update-notice { position: fixed; inset-inline: 12px; top: 12px; z-index: 90; display: flex; align-items: center; gap: 8px; max-width: 460px; margin-inline: auto; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--ink); color: var(--surface, var(--c-white)); box-shadow: 0 8px 24px var(--k-update-notice-shadow); font-size: .9rem; }
.update-notice-text { flex: 1 1 auto; font-weight: 600; }
.update-notice button { flex: 0 0 auto; width: auto; margin: 0; white-space: nowrap; }
.update-notice-go { padding: 7px 14px; border-radius: 999px; background: var(--primary); color: var(--primary-ink, var(--c-white)); border: 0; font-weight: 700; }
.update-notice-x { width: 32px !important; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.1rem; line-height: 1; }
.market-detail-actions > button { width: auto; flex: 1 1 auto; }

/* ── صفحة تفاصيل العرض: وصف مرتّب، معرض يُكبَّر، أزرار مدمجة ── */
.market-listing-detail { padding-bottom: 120px; }
.market-listing-detail > .market-sub-head { margin-bottom: 8px; }
.market-detail-description {
  margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); white-space: normal;
}
.market-detail-description h2 { margin: 0 0 8px; font-size: .95rem; color: var(--muted); font-weight: 700; }
.market-detail-description ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.market-detail-description li {
  padding: 9px 0; line-height: 1.7; border-top: 1px solid var(--line);
}
.market-detail-description li:first-child { border-top: 0; padding-top: 0; }
.market-detail-description li:last-child { padding-bottom: 0; }
/* wrap لا nowrap: أربعة أزرار (إعجاب، مفضلة، مراسلة، مشاركة) تفيض أفقياً عند 390px */
.market-detail-actions { flex-wrap: wrap; }
.market-detail-actions > button { min-height: 44px; }
.market-detail-actions > .primary { flex: 1 1 auto; }
.market-detail-actions > .ghost { flex: 0 0 auto; padding-inline: 14px; }
.market-bubble-row .market-info-bubble { font-size: .8rem; padding: 0 10px; min-height: 34px; }
.market-comment-composer textarea, .market-listing-detail textarea { resize: none; }
.market-media-frame.zoomable { cursor: zoom-in; }
.market-media-frame.zoomable:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.image-viewer {
  position: fixed; inset: 0; z-index: 200; background: var(--k-image-viewer-bg);
  display: flex; align-items: center; justify-content: center;
}
.image-viewer-stage {
  width: 100%; height: 100%; overflow: auto; display: flex; align-items: center; justify-content: center;
  touch-action: pinch-zoom pan-x pan-y; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.image-viewer-stage img {
  max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  user-select: none; -webkit-user-drag: none;
}
.image-viewer-stage img.zoomed { max-width: none; max-height: none; width: 220%; cursor: zoom-out; }
.image-viewer-close, .image-viewer-nav {
  position: absolute; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  background: var(--k-image-viewer-close-bg); color: var(--c-white); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.image-viewer-close { top: calc(12px + env(safe-area-inset-top)); inset-inline-start: 12px; }
.image-viewer-nav { top: 50%; translate: 0 -50%; }
.image-viewer-nav.prev { right: 10px; }
.image-viewer-nav.next { left: 10px; }
.image-viewer-count {
  position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); inset-inline: 0; text-align: center;
  color: var(--c-white); font-size: .85rem; pointer-events: none;
}
body.viewer-open { overflow: hidden; }

/* مدير غلاف العرض في «إدارة العرض» */
.market-owner-covers { display: grid; gap: 8px; margin-bottom: 14px; }
.market-owner-covers h3 { margin: 0; }
.market-cover-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.market-cover-pick { display: grid; gap: 6px; }
.market-focus-holder { position: relative; border-radius: 12px; overflow: hidden; cursor: crosshair; background: var(--surface-2); line-height: 0; }
.market-focus-holder img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.market-focus-dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  border: 3px solid var(--c-white); background: var(--c-black-a45); box-shadow: 0 0 0 2px var(--c-black-a45); pointer-events: none; }

/* صوت الطوارئ والتوجيه السريع: مؤشرات ظاهرة دائماً أثناء فتح الميكروفون أو سماع توجيه */
.sos-voice-bar, .intercom-talk-bar { position: fixed; inset-inline: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-weight: 700;
  background: var(--k-sos-voice-bar-bg); color: var(--c-white); box-shadow: 0 8px 24px var(--k-sos-voice-bar-shadow); }
.sos-voice-bar span { flex: 1; }
.sos-voice-bar .ghost { color: var(--c-white); border-color: var(--k-sos-voice-bar-ghost-line); }
.intercom-talk-bar { background: var(--k-intercom-talk-bar-bg); top: calc(64px + env(safe-area-inset-top)); }
.intercom-banners { position: fixed; inset-inline: 12px; top: calc(10px + env(safe-area-inset-top)); z-index: 91; display: grid; gap: 8px; }
.intercom-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--k-intercom-banner-bg); color: var(--c-white); font-weight: 800; box-shadow: 0 8px 24px var(--k-intercom-banner-shadow); }
.emergency-voice { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

.vet-sponsored-badge { color: var(--muted); font-size: .8em; font-weight: 500; }

/* شاشة الاشتراك: الاستخدام مقابل الحدود والأسئلة الشائعة */
.usage-row { margin: 10px 0; }
.usage-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.usage-fill { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.usage-fill.warn { background: var(--danger); }
.capacity-banner { margin: 10px 0; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); border: 1px solid var(--warn); }
.capacity-banner p { margin: 4px 0 8px; }
.capacity-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.faq-item { margin: 12px 0; }
.faq-item p { margin: 4px 0 0; }

/* مفضلة العروض: زر حفظ خاص فوق صورة البطاقة (أيقونة bookmark تُملأ عند التفعيل) */
.market-fav-toggle[aria-pressed="true"] { color: var(--primary); }
.market-fav-overlay {
  position: absolute; top: 9px; inset-inline-end: 9px; width: 36px; height: 36px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 999px;
  background: var(--c-white-a50); color: var(--primary); cursor: pointer;
}
.market-fav-overlay:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* دليل إنجاز المهمة */
.task-line { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.task-line .task-row { flex: 1; margin-bottom: 0; }
.task-line .ghost, .task-evidence .ghost { display: inline-flex; align-items: center; gap: 4px; }
.task-evidence { display: inline-flex; gap: 6px; align-items: center; margin-inline-start: 8px; }
.task-evidence a { text-decoration: none; padding: 4px 8px; border: 1px solid var(--line, var(--k-task-evidence-line)); border-radius: 8px; }

.draft-chip { display: flex; align-items: center; gap: 6px; padding: 6px 12px; margin-bottom: 10px; border-radius: 999px; background: var(--surface2, var(--k-draft-chip-bg)); font-size: 13px; }

/* ── ملف الرأس: تبويبات ونسب وخط زمني (البنود 14/34/36/41) ── */
.passport-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 12px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}
.passport-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
}
.passport-tabs button[aria-selected="true"] { background: var(--warn); color: var(--c-white); }
.passport-panel[hidden] { display: none; }
.pedigree-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.pedigree-node { display: grid; gap: 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.head-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tl-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.tl-item:last-child { border-bottom: 0; }
.tl-mark { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); font-size: .72rem; }
.tl-body { display: grid; gap: 2px; min-width: 0; }
.tl-body strong { overflow-wrap: anywhere; }
.tl-date { white-space: nowrap; direction: ltr; }

/* المساعد الذكي (بند 62) */
.assistant-panel { display: grid; gap: 10px; min-width: 0; }
.assistant-banner { padding: 10px 12px; border-radius: 12px; background: var(--surface-2, var(--k-assistant-banner-bg)); }
.assistant-banner.assistant-off { border: 1px dashed var(--muted, var(--k-assistant-banner-assistant-off-line)); }
.assistant-log { display: grid; gap: 8px; max-height: 46vh; overflow-y: auto; align-content: start; min-height: 80px; }
.assistant-msg { padding: 9px 12px; border-radius: 14px; max-width: 88%; overflow-wrap: anywhere; white-space: pre-wrap; }
.assistant-user { justify-self: start; background: var(--primary); color: var(--c-white); }
.assistant-bot { justify-self: end; background: var(--surface-2, var(--k-assistant-bot-bg)); }
.assistant-error { border: 1px solid var(--danger, var(--k-assistant-error-line)); }
.assistant-compose { display: flex; gap: 8px; align-items: flex-end; }
.assistant-input { flex: 1; min-width: 0; resize: none; font: inherit; }
.assistant-send { min-width: 48px; min-height: 48px; }
/* FX2 (بند 10): حقل الكتابة يأخذ العرض المتبقي بارتفاع ≥44، وزر الإرسال أيقونة ثابتة 48×48 في طرف النهاية (كان يملأ الصف ويعصر الحقل إلى ~25px) */
html body .assistant-panel .assistant-compose { align-items: stretch; }
html body .assistant-panel .assistant-compose .assistant-input { flex: 1 1 0; width: auto; min-width: 0; min-height: 48px; }
html body .assistant-panel .assistant-compose .assistant-send { flex: 0 0 48px; width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0; align-self: flex-end; display: inline-grid; place-items: center; }
.assistant-compose .assistant-input:disabled { opacity: .6; cursor: not-allowed; }
.assistant-compose .assistant-send:disabled { opacity: .5; cursor: not-allowed; }
.assistant-disclaimer { margin: 0; font-size: .82rem; opacity: .8; }
.assistant-clear { justify-self: start; }

/* إعلان مدفوع في سوق المنتجات: وسم إلزامي ظاهر */
.sm-card.is-sponsored { border-style: dashed; }
.sm-ad-badge { align-self: flex-start; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2, var(--k-sm-ad-badge-bg)); color: var(--muted, var(--k-sm-ad-badge-ink)); border: 1px solid var(--line, var(--c-gray-ddd)); }

/* WAVE2: مؤشر التحميل بالعلامة + «مراح ذكي» نصاً حيّاً (لا صورة كلمة) */
.brand-loader { flex-direction: column; gap: 2px; }
.brand-loader img { width: 44px; height: 44px; }
.brand-loader-name { font: 700 13px/1.5 var(--font-display, inherit); color: var(--c-forest-700); }
.compact .brand-loader img { width: 32px; height: 32px; }
.compact .brand-loader-name { display: none; }
.brand-loader img.brand-loader-art { width: 72px; height: auto; }
.compact .brand-loader img.brand-loader-art { width: 48px; height: auto; }

/* قائمة الاستحقاقات الكاملة داخل صف التنبيه في الورقة */
.alert-items-list { margin: 4px 0 0; padding-inline-start: 18px; }
