/* ══ إدارة الصيدليات (phx) ═══════════════════════════════════════════
   ملف معزول: كل الأصناف تبدأ بـ phx- ولا تعتمد على أنماط اللوحة القديمة
   المتراكبة (!important في عدة ملفات). اللوحة داكنة دائمًا (data-theme=dark). */
.phx {
  --phx-card: #0F2921;
  --phx-card-2: #133429;
  --phx-line: rgba(255, 255, 255, 0.08);
  --phx-text: #F8FAFC;
  --phx-muted: #A7B5AF;
  --phx-green: #34D89E;
  --phx-green-bg: rgba(52, 216, 158, 0.14);
  --phx-red: #F87171;
  --phx-red-bg: rgba(248, 113, 113, 0.14);
  --phx-amber: #FBBF24;
  --phx-amber-bg: rgba(251, 191, 36, 0.14);
  --phx-radius: 20px;
  color: var(--phx-text);
}

.phx-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.phx-h2 { margin: 0; font-size: 26px; font-weight: 800; color: var(--phx-text); }
.phx-lead { margin: 6px 0 0; color: var(--phx-muted); font-size: 14px; max-width: 60ch; }
.phx-top-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.phx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 14px; cursor: pointer;
  font: 700 14px/1 inherit; border: 1px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.phx-btn:active { transform: translateY(1px); }
.phx-btn .material-symbols-outlined { font-size: 20px; }
.phx-btn-primary { background: var(--phx-green); color: #04221B; }
.phx-btn-primary:hover { background: #5FE6B5; }
.phx-btn-ghost { background: transparent; color: var(--phx-text); border-color: var(--phx-line); }
.phx-btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }
.phx-btn-danger { background: transparent; color: var(--phx-red); border-color: rgba(248, 113, 113, 0.4); }
.phx-btn-danger:hover { background: var(--phx-red-bg); }
.phx-btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.phx-btn-sm .material-symbols-outlined { font-size: 17px; }

/* ── الملخص ── */
.phx-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.phx-stat {
  text-align: start; cursor: pointer; display: grid; gap: 4px;
  background: var(--phx-card); border: 1px solid var(--phx-line); border-radius: var(--phx-radius);
  padding: 16px 18px; color: var(--phx-text); transition: border-color .15s ease, background-color .15s ease;
}
.phx-stat:hover { border-color: rgba(52, 216, 158, 0.35); }
.phx-stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; font-family: Inter, inherit; }
.phx-stat-label { color: var(--phx-muted); font-size: 13px; font-weight: 600; }
.phx-stat.ok .phx-stat-num { color: var(--phx-green); }
.phx-stat.bad .phx-stat-num { color: var(--phx-red); }
.phx-stat.warn .phx-stat-num { color: var(--phx-amber); }

/* ── شريط البحث والتصفية ── */
.phx-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.phx-search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px;
  background: var(--phx-card); border: 1px solid var(--phx-line); border-radius: 14px; padding: 0 14px; min-height: 46px;
}
.phx-search .material-symbols-outlined { color: var(--phx-muted); font-size: 20px; }
.phx-search input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--phx-text); font: 500 14px inherit; min-width: 0; }
.phx-search:focus-within { border-color: var(--phx-green); }
.phx-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.phx-chip {
  min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--phx-muted); border: 1px solid var(--phx-line); font: 700 13px inherit;
}
.phx-chip.active { background: var(--phx-green-bg); color: var(--phx-green); border-color: rgba(52, 216, 158, 0.4); }

/* ── البطاقات ── */
.phx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.phx-card {
  background: linear-gradient(180deg, var(--phx-card-2), var(--phx-card));
  border: 1px solid var(--phx-line); border-radius: var(--phx-radius);
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  border-top: 4px solid var(--phx-green);
}
.phx-card.is-hidden { border-top-color: var(--phx-red); }
.phx-card.is-pending { border-top-color: var(--phx-amber); }

.phx-head { display: flex; align-items: center; gap: 12px; }
.phx-avatar {
  width: 48px; height: 48px; flex: none; border-radius: 15px; display: grid; place-items: center;
  background: var(--phx-green-bg); color: var(--phx-green); font-weight: 800; font-size: 20px;
}
.phx-card.is-hidden .phx-avatar { background: var(--phx-red-bg); color: var(--phx-red); }
.phx-title { flex: 1; min-width: 0; }
.phx-title h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--phx-text); overflow-wrap: anywhere; }
.phx-sub { margin-top: 3px; font-size: 12.5px; color: var(--phx-muted); direction: ltr; text-align: end; overflow-wrap: anywhere; }

.phx-pill {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.phx-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.phx-pill.ok { background: var(--phx-green-bg); color: var(--phx-green); }
.phx-pill.bad { background: var(--phx-red-bg); color: var(--phx-red); }
.phx-pill.warn { background: var(--phx-amber-bg); color: var(--phx-amber); }

.phx-reason {
  display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 14px;
  font-size: 13.5px; font-weight: 600; line-height: 1.6;
}
.phx-reason .material-symbols-outlined { font-size: 19px; flex: none; margin-top: 1px; }
.phx-reason.bad { background: var(--phx-red-bg); color: #FECACA; }
.phx-reason.warn { background: var(--phx-amber-bg); color: #FDE68A; }

.phx-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.phx-checks li { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--phx-text); line-height: 1.45; }
.phx-checks li::before {
  flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 900; margin-top: 1px;
}
.phx-checks li.ok::before { content: "✓"; background: var(--phx-green-bg); color: var(--phx-green); }
.phx-checks li.bad::before { content: "✕"; background: var(--phx-red-bg); color: var(--phx-red); }
.phx-checks li.warn::before { content: "!"; background: var(--phx-amber-bg); color: var(--phx-amber); }
.phx-checks small { display: block; color: var(--phx-muted); font-size: 11.5px; }

.phx-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.phx-meta div { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--phx-line); border-radius: 12px; padding: 8px 10px; }
.phx-meta dt { font-size: 11.5px; color: var(--phx-muted); }
.phx-meta dd { margin: 2px 0 0; font-size: 14px; font-weight: 800; color: var(--phx-text); }

.phx-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.phx-actions .phx-btn-main { width: 100%; }
.phx-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.phx-more { position: relative; }
.phx-more summary { list-style: none; }
.phx-more summary::-webkit-details-marker { display: none; }
.phx-more-menu {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 220px;
  background: #0B231C; border: 1px solid var(--phx-line); border-radius: 14px; padding: 6px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6); display: grid; gap: 2px;
}
.phx-more-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 10px;
  background: transparent; border: 0; color: var(--phx-text); font: 600 13.5px inherit; cursor: pointer; text-align: start;
}
.phx-more-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.phx-more-menu button.danger { color: var(--phx-red); }
.phx-more-menu .material-symbols-outlined { font-size: 18px; }

.phx-empty {
  grid-column: 1 / -1; text-align: center; padding: 48px 16px; color: var(--phx-muted);
  background: var(--phx-card); border: 1px dashed var(--phx-line); border-radius: var(--phx-radius);
}

/* ── تنبيه «نظرة عامة» ── */
.phx-alert {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 14px 18px; border-radius: 18px; background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35); color: #FECACA; font-weight: 700;
}
.phx-alert.hidden { display: none; }
.phx-alert .material-symbols-outlined { color: #F87171; }
.phx-alert span.phx-alert-text { flex: 1; min-width: 200px; }

@media (max-width: 900px) {
  .phx-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .phx-grid { grid-template-columns: minmax(0, 1fr); }
  .phx-checks { grid-template-columns: minmax(0, 1fr); }
  .phx-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
