/* app-extras.css: اللمس وتقليل الحركة وإضافات متفرقة. الملفات تُحمَّل بالترتيب: app.css, app-theme.css, app-motion.css, app-deeds.css, app-extras.css, app-lit.css, app-petitions.css */
/* touch: no double-tap zoom delay, no text selection when long-pressing controls, scroll stays inside dialogs */
button,
a,
summary,
label,
.btn,
.mrow,
.mc {
  touch-action: manipulation;
}
.btn,
.tab,
.sbtn,
.stg,
.seg,
.tabbar,
.fabb,
.fabm,
.catb,
summary {
  -webkit-user-select: none;
  user-select: none;
}
.ov,
.pop,
.palr {
  overscroll-behavior: contain;
}
@supports (height: 100dvh) {
  .boot {
    min-height: 100dvh;
  }
  @media (max-width: 860px) {
    .dlg,
    .dlg.wide {
      max-height: 92dvh;
    }
  }
}

/* reduced motion: keep the feedback (opacity, colour), drop the travel */
@media (prefers-reduced-motion: reduce) {
  #main.enter,
  .ov > .dlg,
  #toasts .toast,
  .pop:not([hidden]),
  .fabm:not([hidden]),
  details.morem[open] > div,
  details.sec[open] > .secb {
    animation-name: fade !important;
  }
  .ov.out > .dlg,
  #toasts .toast.out {
    animation-name: fadeout !important;
  }
  .boot i {
    animation: fade 0.4s 0.3s both;
  }
  .mrow:hover,
  .catb:hover,
  .mc.dragging,
  :is(
      .btn,
      .sbtn,
      .stg,
      .seg button,
      .seg a.segl,
      .catb,
      .qbtn,
      .tabbar a,
      .tabbar button,
      .mrow,
      a.card,
      .mc,
      .fabb
    ):active {
    transform: none !important;
  }
  .fab.away {
    transform: none;
  }
  details.sec > summary::before {
    transition: none;
  }
}

/* خانات ملف العميل */
.drv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.fold {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: right;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.12s;
}
.fold:hover {
  border-color: color-mix(in srgb, var(--acc) 35%, var(--line));
  transform: translateY(-1px);
}
.fold .ico {
  width: 24px;
  height: 24px;
  color: var(--acc);
  margin-bottom: 2px;
}
.fold .fd {
  font-size: 12px;
  line-height: 1.5;
}
.infold .fchip {
  display: none;
}
@media (max-width: 860px) {
  .drv {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .fold {
    padding: 12px;
  }
  .fold .fd {
    display: none;
  }
}

/* نافذة التأكيد: فوق أي نافذة مفتوحة */
.ov.ask {
  z-index: 70;
  align-items: center;
}
.dlg.sm {
  max-width: 420px;
}
.askm {
  margin: 0 0 16px;
  line-height: 1.8;
  font-size: 15px;
}
.askin {
  width: 100%;
  margin-bottom: 16px;
}

/* خانة التاريخ يوم/شهر/سنة على الحاسوب */
.dbx {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.dbx > input[type="text"] {
  flex: 1;
  min-width: 0;
  text-align: right;
}
.dbxb {
  flex: none;
  width: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--mute);
  cursor: pointer;
}
.dbxb:hover {
  color: var(--acc);
}
.dbxb svg {
  width: 17px;
  height: 17px;
}
.dbx > input[type="date"] {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* شاشة الدخول والإعداد: بطاقة واحدة لا بطاقة داخل بطاقة */
.auth > .card form {
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}
/* زر الإضافة السريعة على الحاسوب: في الشريط العلوي لا فوق المحتوى */
@media (min-width: 861px) {
  body:has(.fab) .tb {
    padding-left: 150px;
  }
  .fab {
    top: 13px;
    bottom: auto;
    left: 32px;
    flex-direction: column;
    z-index: 45;
  }
  .fabb {
    width: auto;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: var(--shadow);
  }
  .fabb::after {
    content: " إضافة";
  }
}
/* قراءة فقط (صاحب الشركة): الموقف الحالي وحده، والمراحل الأخرى باهتة */
.sbtn:disabled:not(.on) {
  display: none;
}
.sbtn:disabled,
.stg:disabled {
  cursor: default;
}
.stg:disabled:not(.on) {
  opacity: 0.55;
}
.sech {
  margin: 26px 0 12px;
  font-size: 16px;
}
.danger-zone {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
}
.danger-zone h4 {
  color: var(--danger);
}
@media (max-width: 860px) {
  .card > .sh {
    flex-wrap: wrap;
    gap: 8px;
  }
  .tabs,
  .seg {
    -webkit-mask-image: linear-gradient(
      to left,
      #000 calc(100% - 28px),
      transparent
    );
    mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
  }
}
/* نتيجة الجلسة في قائمة المواعيد */
.hres {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink);
}
.hres b {
  color: var(--acc);
}

/* تنبيه النسخ الاحتياطي في صفحة «اليوم» (للإدارة) */
.warnbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border-color: var(--warn);
  line-height: 1.8;
}
.warnbar .btn {
  flex-shrink: 0;
}
@media (max-width: 860px) {
  .warnbar {
    flex-direction: column;
    align-items: stretch;
  }
  /* الجداول على الهاتف: بطاقة لكل صف، واسم العمود بجانب كل قيمة */
  .tw:has(> table.mcards) {
    overflow: visible;
  }
  table.mcards thead {
    display: none;
  }
  table.mcards,
  table.mcards tbody,
  table.mcards tr {
    display: block;
    width: auto;
  }
  table.mcards tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 12px;
    margin: 0 0 10px;
    background: var(--panel);
  }
  table.mcards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px dashed var(--line);
    text-align: start;
    white-space: normal;
  }
  table.mcards td:last-child {
    border-bottom: 0;
  }
  table.mcards td::before {
    content: attr(data-label);
    color: var(--mute);
    font-size: 13px;
    flex-shrink: 0;
  }
  table.mcards td[data-label=""] {
    justify-content: flex-end;
  }
  table.mcards td[data-label=""]::before {
    display: none;
  }
  table.mcards td:empty {
    display: none;
  }
  /* مسافة أسفل الصفحة تكفي لزر الإضافة العائم، فلا يغطي آخر المحتوى */
  main {
    padding-bottom: calc(160px + env(safe-area-inset-bottom));
  }
}
/* الحقل المخفي برمجياً (مثل حقول نتيجة الجلسة لغير الجلسات) يُخفى فعلاً: عرض .fl كان يغلب سمة hidden */
.fl[hidden] {
  display: none !important;
}

/* محرر الطلب على ورقة الشركة: المعاينة بطول أكبر لأنها صفحة A4 كاملة */
.ltg .pvw {
  height: 78vh;
}
.ltg .pvw iframe {
  height: calc(78vh / var(--s, 1));
}

/* القيد المالي البسيط: «دفعتُ» بالأحمر و«استلمتُ» بالأخضر */
.lform .lamt {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}
.ldir {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 12px;
}
.ld {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
}
.ld input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ld b {
  font-size: 18px;
}
.ld span {
  font-size: 12.5px;
  color: var(--mute);
  line-height: 1.6;
}
.ld.out b {
  color: var(--danger);
}
.ld.in b {
  color: var(--ok);
}
.ld.out:has(input:checked) {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.ld.in:has(input:checked) {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}
.ld:has(input:focus-visible) {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
@media (max-width: 860px) {
  .ldir {
    grid-template-columns: 1fr;
  }
}

/* فترة الكشف: من / إلى وأزرار سريعة، ورصيد أول المدة وآخرها */
.perbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}
.perbar label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.perbar .btn.on {
  border-color: var(--acc);
  color: var(--acc);
}
tr.perow td {
  font-weight: 700;
  background: var(--bg);
}
.perend {
  margin: 8px 0 0;
}

/* الاشتراك (النسخة السحابية): أشرطة الاستهلاك والميزات */
.plancard .pbar {
  margin: 10px 0;
}
.plancard .bar {
  height: 8px;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 4px;
}
.plancard .bar i {
  display: block;
  height: 100%;
  background: var(--c-green);
}
.plancard .bar i.hi {
  background: var(--c-red);
}
.pfeat {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* شارة خطة الاشتراك بجانب اسم المكتب (وفي الشريط العلوي على الهاتف) */
:root {
  --pb-free-bg: #e9eef5;
  --pb-free-ink: #4b5d73;
  --pb-plus-bg: #dce9ff;
  --pb-plus-ink: #1d5bbf;
}
@media (prefers-color-scheme: dark) {
  :root {
    --pb-free-bg: #253142;
    --pb-free-ink: #a9bad0;
    --pb-plus-bg: #17345c;
    --pb-plus-ink: #8fbcff;
  }
}
.pbadge {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  font:
    600 11px/1 "IBM Plex Sans Arabic",
    system-ui,
    sans-serif;
  letter-spacing: 0.03em;
  direction: ltr;
  white-space: nowrap;
  vertical-align: middle;
  cursor: default;
}
button.pbadge {
  cursor: pointer;
}
button.pbadge:hover {
  filter: brightness(1.08);
}
button.pbadge:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.pbadge.t-free {
  background: var(--pb-free-bg);
  color: var(--pb-free-ink);
}
.pbadge.t-plus {
  background: var(--pb-plus-bg);
  color: var(--pb-plus-ink);
}
.pbadge.t-max {
  background: linear-gradient(135deg, #f4d98b, #c99a3a);
  color: #3a2806;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
/* القائمة الجانبية داكنة دائماً: ألوان Free وPlus الداكنة فيها */
.side .pbadge.t-free {
  background: #253142;
  color: #a9bad0;
}
.side .pbadge.t-plus {
  background: #17345c;
  color: #8fbcff;
}
.brand .bname {
  min-width: 0;
}
.pbm {
  display: none;
}
@media (max-width: 860px) {
  .pbm {
    display: inline-flex;
    align-self: center;
  }
}

/* الدعم الفني عبر واتساب (أعلى صفحة الإعدادات) */
.supcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.supcard:hover {
  border-color: #25d366;
}
.supcard:focus-visible {
  outline: 2px solid #25d366;
  outline-offset: 2px;
}
.supic {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #25d366;
}
.supic svg {
  width: 26px;
  height: 26px;
}
.suptx {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}
.suptx .mute {
  font-size: 13px;
}
.supgo {
  flex: none;
  font-size: 18px;
  color: var(--mute);
}
.supcard:hover .supgo {
  color: #1da851;
}

/* حالة الاشتراك (النسخة السحابية): الشريط أعلى الصفحات وسطر الحالة في صفحة الاشتراك */
.subbar.bad {
  border-color: var(--danger);
}
.substate {
  margin: 0 0 10px;
}
.substate.trial b,
.substate.active b,
.substate.open b {
  color: var(--ok);
}
.substate.late b {
  color: var(--warn);
}
.substate.readonly b {
  color: var(--danger);
}
.paylog summary {
  cursor: pointer;
  color: var(--acc);
  margin: 6px 0;
}

/* التحقق بخطوتين: رمز QR والمفتاح */
.totpqr {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}
.totpqr svg {
  border-radius: 8px;
  max-width: 100%;
  height: auto;
}
.totpkey {
  letter-spacing: 0.06em;
  font-size: 15px;
}

/* نافذة «ما الجديد» */
.news {
  margin: 4px 0 14px;
}
.news ul {
  margin: 6px 0 0;
  padding-inline-start: 20px;
  line-height: 1.8;
}

/* اسم النظام أسفل بطاقة الدخول */
.auth .authbrand {
  text-align: center;
  margin-top: 14px;
  font-size: 12px;
}
/* شعار إنكيدو فوق الاسم: قناع بلون --gold فيتبع الوضع الليلي */
.auth .authbrand::before {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 4px;
  background: #c9a24a;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23000'%3E%3Cg transform='translate(50 16) scale(.75)'%3E%3Ccircle r='9.5'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(0)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(45)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(90)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(135)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(180)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(225)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(270)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(315)'/%3E%3C/g%3E%3Crect x='47.5' y='30' width='5' height='22'/%3E%3Crect x='10' y='30' width='80' height='4.5' rx='2.2'/%3E%3Cpath d='M5 50h18a9 9 0 0 1-18 0zM77 50h18a9 9 0 0 1-18 0z'/%3E%3Crect x='40' y='52' width='20' height='10' rx='1.5'/%3E%3Crect x='30' y='64' width='40' height='11' rx='1.5'/%3E%3Crect x='20' y='77' width='60' height='12' rx='1.5'/%3E%3C/g%3E%3Cpath d='M14 34l-8 16M14 34l8 16M86 34l-8 16M86 34l8 16' stroke='%23000' stroke-width='1.8' fill='none'/%3E%3C/svg%3E")
    center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cg fill='%23000'%3E%3Cg transform='translate(50 16) scale(.75)'%3E%3Ccircle r='9.5'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(0)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(45)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(90)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(135)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(180)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(225)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(270)'/%3E%3Crect x='-1.6' y='-19' width='3.2' height='6' rx='1.6' transform='rotate(315)'/%3E%3C/g%3E%3Crect x='47.5' y='30' width='5' height='22'/%3E%3Crect x='10' y='30' width='80' height='4.5' rx='2.2'/%3E%3Cpath d='M5 50h18a9 9 0 0 1-18 0zM77 50h18a9 9 0 0 1-18 0z'/%3E%3Crect x='40' y='52' width='20' height='10' rx='1.5'/%3E%3Crect x='30' y='64' width='40' height='11' rx='1.5'/%3E%3Crect x='20' y='77' width='60' height='12' rx='1.5'/%3E%3C/g%3E%3Cpath d='M14 34l-8 16M14 34l8 16M86 34l-8 16M86 34l8 16' stroke='%23000' stroke-width='1.8' fill='none'/%3E%3C/svg%3E")
    center/contain no-repeat;
}

/* شريط «ثبّت إنكيدو على جهازك» */
.instbar {
  position: fixed;
  z-index: 60;
  inset-inline: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 520px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(16, 24, 40, 0.18);
  animation: instin 0.25s ease-out;
}
.instbar img {
  border-radius: 10px;
  flex: none;
}
.instbar .itx {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.instbar .itx span {
  color: var(--mute);
  font-size: 13px;
  line-height: 1.6;
}
.instbar .itx svg {
  vertical-align: -3px;
}
.instbar .ibt {
  display: flex;
  gap: 6px;
  flex: none;
}
@keyframes instin {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .instbar {
    animation: none;
  }
}
@media (max-width: 860px) {
  body:has(.tabbar) .instbar {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
  .instbar {
    flex-wrap: wrap;
  }
  .instbar .ibt {
    width: 100%;
    justify-content: flex-end;
  }
}
/* مساحة أسفل الصفحة ما دام الشريط ظاهراً، فلا يغطي آخر الصفحة (زر الدخول مثلاً) */
body:has(#instbar) {
  padding-bottom: 180px;
}
