/* لوحة الطلبات: فوق نفس ستايل صفحة التصميم (dashboard.css) */
.a-main {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: -52px auto 0;
  padding: 0 max(20px, env(safe-area-inset-left, 0px)) 80px;
}

.a-login {
  max-width: 440px;
  margin: 0 auto;
}

.a-login .btn {
  width: 100%;
}

.a-logout {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(246, 247, 237, 0.16);
  color: #f6f7ed;
}

.a-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- القائمة ---------- */
.a-tabs {
  margin-bottom: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.a-count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 31, 63, 0.08);
  font-size: 0.78rem;
}

.seg button.is-active .a-count {
  background: rgba(246, 247, 237, 0.22);
}

.a-list {
  display: grid;
  gap: 10px;
}

.a-list .d-empty {
  padding: 40px 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.a-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.a-item:hover {
  transform: translateY(-2px);
}

.a-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--navy);
  color: #f6f7ed;
  font-family: var(--display);
  font-size: 1.2rem;
}

.a-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f6f7ed;
}

.a-item-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.a-item-text b,
.a-item-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a-item-text small {
  color: var(--ink-2);
}

.a-status {
  flex: none;
  padding: 0.3em 0.9em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--navy);
}

.a-status.is-accepted {
  background: #dcfce7;
  color: #15803d;
}

.a-status.is-rejected {
  background: #fee2e2;
  color: #b91c1c;
}

.a-status.is-warn {
  background: #fef3c7;
  color: #92400e;
}

.a-status.is-paused {
  background: #e4e8d8;
  color: var(--muted);
}

.order-error.is-ok {
  background: #ecfdf3;
  color: #15803d;
}

/* ---------- الأقسام (الطلبات / الزبائن) ---------- */
.a-sections {
  margin-bottom: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.a-sections button {
  font-size: 1rem;
}

.a-overview {
  margin: 0 0 14px;
  padding: 16px;
  container-type: inline-size;
}

.a-overview #c-overview-chart:not(:empty) {
  margin-top: 14px;
}

@container (min-width: 760px) {
  .st-overview {
    grid-template-columns: 1.5fr 1fr;
  }
}

.a-overview .st-value {
  font-size: 1.45rem;
}

.a-overview .a-muted {
  margin-top: 12px;
}

.a-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

/* الفلاتر بسطر واحد (بيتمرر أفقياً على الموبايل) */
.a-toolbar .a-tabs {
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.a-toolbar .a-tabs::-webkit-scrollbar {
  display: none;
}

@media (max-width: 560px) {
  .a-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .a-toolbar .a-tabs button {
    flex: none;
  }
}

.a-toolbar .a-tabs button {
  white-space: nowrap;
}

/* ---------- ملف الزبون ---------- */
.a-info h3 small {
  font-family: var(--font);
  font-weight: 500;
}

.a-form .btn-primary {
  width: 100%;
}

.a-pay {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.a-pay-row {
  align-items: center;
}

.a-pay-row > span {
  flex: 1;
  color: var(--ink-2);
}

.a-pay-row .icon-btn {
  width: 32px;
  height: 32px;
}

.a-cred {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f1f4ff;
}

.a-cred p {
  margin: 0 0 4px;
}

.a-cred .a-row {
  border-color: rgba(25, 51, 214, 0.12);
}

.a-pass {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.a-cred .a-actions {
  margin-top: 10px;
}

.a-card-links {
  background: var(--field);
}

.a-acct {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--brand-soft);
}

.a-acct p {
  margin: 0;
  flex: 1;
  min-width: 180px;
  font-size: 0.9rem;
}

.a-danger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 0;
}

.a-narrow {
  max-width: 620px;
}

#cn-done {
  margin-top: 0;
  text-align: center;
}

#cn-done .order-done-ico {
  margin: 0 auto;
}

#cn-done h3 {
  margin: 8px 0 12px;
  font-family: var(--display);
}

#cn-done .a-row,
#cn-done p {
  text-align: start;
}

#cn-done .a-actions {
  justify-content: center;
  margin-bottom: 14px;
}

/* ---------- التفاصيل ---------- */
body.detail-open {
  overflow: hidden;
}

.a-detail {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 31, 63, 0.7);
}

.a-detail-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 26px;
  background: var(--bg);
}

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

.a-detail-head h2 {
  margin: 4px 0 0;
  font-size: 1.5rem;
}

.a-detail-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.a-phone {
  position: sticky;
  top: 0;
}

/* نفس إطار الموبايل بالمحرر (390×844)، بدون شريط حالة */
.a-phone .d-phone {
  width: 300px;
  height: calc((300px - 18px) * 844 / 390 + 18px);
}

.a-phone .d-screen iframe {
  top: 0;
  height: 844px;
}

.a-info {
  display: grid;
  gap: 14px;
}

.a-info .d-card {
  padding: 20px;
}

.a-info h3 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.05rem;
}

.a-rows {
  margin-bottom: 12px;
}

.a-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.93rem;
}

.a-row:last-child {
  border-bottom: 0;
}

.a-row > span {
  flex: none;
  color: var(--muted);
}

.a-row b,
.a-row a {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: end;
}

.a-row a {
  color: var(--navy);
}

.a-row-col {
  flex-direction: column;
}

.a-links {
  margin: 0;
  padding-inline-start: 18px;
  display: grid;
  gap: 4px;
}

.a-images {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.a-img {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.a-img img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 12px;
  background: conic-gradient(#e4e8d8 25%, #eef0e3 0 50%, #e4e8d8 0 75%, #eef0e3 0) 0 0 / 14px 14px;
  border: 1px solid var(--line);
}

.a-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.a-actions .btn-primary {
  flex: 1;
}

.a-live {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #ecfdf3;
}

.a-link {
  display: block;
  margin: 2px 0 6px;
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
  text-align: start;
}

@media (max-width: 760px) {
  .a-detail {
    padding: 0;
  }
  .a-detail-inner {
    border-radius: 0;
    min-height: 100%;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 24px;
  }
  .a-detail-grid {
    grid-template-columns: 1fr;
  }
  .a-phone {
    position: static;
  }
  /* ملف الزبون على الموبايل: الأرقام والاشتراك أولاً، والمعاينة بالآخر */
  #cdetail .a-phone {
    order: 2;
  }
  .a-phone .d-phone {
    width: 260px;
    height: calc((260px - 18px) * 844 / 390 + 18px);
  }
  .a-live {
    flex-direction: column;
    text-align: center;
  }
}

/* ---------- جاهزية الموقع (تحت تسجيل الدخول) ---------- */
.a-setup {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.a-setup h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.a-setup ul {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.a-setup li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
}

.a-setup li > i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  font-size: 0.7rem;
  color: #f6f7ed;
}

.a-setup li.is-ok > i {
  background: #157347;
}

.a-setup li.is-missing > i {
  background: #b42318;
}

.a-setup li span {
  display: grid;
}

.a-setup small {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .a-backup-text {
    display: none;
  }
}

/* ---------- دخول الإدارة: إيميل وكلمة سر، ونسيت كلمة السر ---------- */
.a-login-step {
  display: grid;
  gap: 14px;
}

.a-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.a-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--navy-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.a-link:disabled {
  color: var(--muted);
  text-decoration: none;
  cursor: default;
}

.a-login-back {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.a-code.a-code {
  font-family: var(--display, "Manrope"), monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
}

/* إيقاف الاشتراك: لما يكون موقوف، البطاقة بتنعلّم بلون تحذير خفيف */
.a-pause.is-paused {
  box-shadow: inset 0 0 0 1.5px #f5d28a;
  background: #fef3c7;
}

.a-pause .a-muted {
  margin: 0 0 12px;
}

/* موبايل صغير: أزرار الشريط فوق أيقونات بس، لحتى «خروج» ما يطلع برّا الشاشة */
@media (max-width: 420px) {
  .a-refresh-text,
  .a-backup-text {
    display: none;
  }
  #top-actions {
    gap: 8px;
  }
  #top-actions .btn-sm {
    min-width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
  }
}

/* بوضع التطبيق: الشريط الكحلي ثابت فوق لحتى يضل وقت الساعة مقروء وإنتا بتمرّر */
html.is-app .d-top:not(.is-fixed) {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* قائمة الطلبات: الباقة والبطاقة وحالة واتساب بعمود، وتنبيه للي ما فتح واتساب */
.a-item-end {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: none;
}

.a-note {
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f6e3b4;
  color: #6b4a00;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.6;
}


/* ---------- تبويب الباقات ---------- */
.pl-h {
  margin: 0;
  font-size: 1.1rem;
}

.a-toolbar .pl-h {
  flex: 1;
}

.pl-intro {
  margin-bottom: 14px;
  padding: 14px 16px;
}

.pl-intro p,
.pl-msgs > p,
.pl-histbox > p {
  margin: 0 0 12px;
}

.pl-list {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

@media (min-width: 760px) {
  .pl-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.pl-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pl-card.is-hi {
  outline: 2px solid var(--lime);
}

.pl-card.is-hidden {
  opacity: 0.7;
}

.pl-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.pl-top b {
  display: block;
  font-size: 1.05rem;
}

.pl-top small {
  color: var(--muted);
}

.pl-price {
  font-weight: 800;
  font-size: 1.3rem;
  text-align: end;
}

.pl-price small {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
}

.pl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pl-chips span {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--off-white-2);
  color: var(--ink-2);
  font-size: 0.8rem;
}

.pl-chips .g {
  background: rgba(219, 230, 76, 0.45);
  color: var(--navy);
}

.pl-chips .n {
  background: var(--off-white-3);
  color: var(--muted);
}

.pl-act {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pl-act .btn {
  margin-inline-start: auto;
}

.pl-act .icon-btn:disabled {
  opacity: 0.35;
}

.pl-chks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.pl-chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.pl-chk {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pl-chk input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  accent-color: var(--navy);
}

.pl-feats {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.pl-feat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pl-feat input {
  flex: 1;
  min-width: 0;
}

.pl-feat .icon-btn:disabled {
  opacity: 0.35;
}

.pl-msgs {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 16px;
}

.pl-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.pl-var {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--off-white-2);
  color: var(--navy);
  font: inherit;
  font-size: 0.82rem;
  direction: ltr;
  cursor: pointer;
}

.pl-msgs textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  font: inherit;
}

.pl-prev {
  min-height: 90px;
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--off-white-3);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.pl-msg-act {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pl-histbox {
  padding: 14px 16px;
}

.pl-histbox summary {
  cursor: pointer;
  font-weight: 700;
}

.pl-histbox[open] summary {
  margin-bottom: 10px;
}

.pl-hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.pl-hist-row small {
  display: block;
  color: var(--muted);
}
