/* ===== نظام التواصل الداخلي — التصميم الموحّد ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0d9488;        /* teal */
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --shadow: 0 10px 30px rgba(2, 32, 45, .08);
  --shadow-lg: 0 20px 50px rgba(2, 32, 45, .16);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background:
     radial-gradient(1200px 600px at 100% -10%, #d9f2ee 0%, transparent 55%),
     radial-gradient(1000px 500px at -10% 110%, #dbeafe 0%, transparent 50%),
     var(--bg);
  color: var(--ink);
  min-height: 100vh;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Header / شعار التجمع ===== */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.logo {
  width: 56px; height: 56px; border-radius: 16px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 28px;
  background: linear-gradient(135deg, var(--brand), #0891b2);
  box-shadow: 0 8px 20px rgba(13,148,136,.35);
}
.brand-titles { display: flex; flex-direction: column; line-height: 1.25; }
.brand-titles b { font-size: 20px; font-weight: 800; }
.brand-titles span { font-size: 13px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.clock { font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.nav-link {
  text-decoration: none; color: var(--brand-dark); font-weight: 700;
  padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; transition: .15s;
}
.nav-link:hover { background: var(--brand-soft); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 20px 60px; }
.page-title { font-size: 26px; font-weight: 800; margin: 6px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 22px; }

/* ===== الصفحة الرئيسية ===== */
.hero { text-align: center; padding: 40px 0 10px; }
.hero .logo { width: 92px; height: 92px; font-size: 48px; margin: 0 auto 18px; border-radius: 26px; }
.hero h1 { font-size: 34px; margin: 0 0 6px; }
.hero p { color: var(--muted); font-size: 17px; margin: 0 0 34px; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.role-card {
  background: var(--surface); border-radius: var(--radius); padding: 30px 22px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
  border: 1px solid var(--line); transition: .18s; text-align: center;
}
.role-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--brand); }
.role-card .ic { font-size: 44px; }
.role-card h3 { margin: 12px 0 6px; font-size: 20px; }
.role-card p { color: var(--muted); font-size: 14px; margin: 0; }

/* ===== اختيار العيادة ===== */
.section-label { font-weight: 800; font-size: 18px; margin: 8px 0 12px; }
.clinic-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 26px; }
.clinic-chip {
  aspect-ratio: 1 / 1; border-radius: 18px; border: 2px solid var(--line);
  background: #fff; font-size: 30px; font-weight: 800; color: var(--ink);
  cursor: pointer; transition: .15s; display: grid; place-items: center;
}
.clinic-chip small { display:block; font-size: 12px; font-weight:600; color: var(--muted); }
.clinic-chip:hover { border-color: var(--brand); }
.clinic-chip.active {
  background: linear-gradient(135deg, var(--brand), #0891b2); color: #fff; border-color: transparent;
  box-shadow: 0 12px 26px rgba(13,148,136,.4); transform: scale(1.03);
}
.clinic-chip.active small { color: rgba(255,255,255,.85); }

/* ===== أزرار الأقسام ===== */
.dept-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.dept-btn {
  border: none; cursor: pointer; border-radius: 24px; padding: 34px 20px;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: .16s; font-family: inherit;
}
.dept-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.dept-btn:active { transform: scale(.97); }
.dept-btn .ic { font-size: 52px; }
.dept-btn .name { font-size: 24px; font-weight: 800; color: var(--ink); }
.dept-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ===== أزرار عامة ===== */
.btn {
  font-family: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
  border: none; border-radius: 14px; padding: 12px 22px; transition: .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ack {
  background: var(--green); color: #fff; font-size: 20px; font-weight: 800;
  padding: 16px 26px; border-radius: 16px; width: 100%; cursor: pointer; border: none;
  box-shadow: 0 8px 20px rgba(22,163,74,.35);
}
.btn-ack:hover { filter: brightness(1.06); }

/* ===== Toast / تنبيه الإرسال ===== */
.toast-host { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display:flex; flex-direction:column; gap:10px; }

/* ===== لوحة طابور النداء (يسار الشاشة) ===== */
.queue-panel {
  position: fixed; top: 96px; left: 18px; bottom: 18px; width: 290px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 16px; z-index: 40;
  display: flex; flex-direction: column; gap: 12px;
}
.qp-head { display: flex; align-items: center; justify-content: space-between; font-size: 17px; }
.qp-head b { font-weight: 800; }
.qp-count {
  background: var(--brand); color: #fff; min-width: 26px; height: 26px; border-radius: 999px;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 14px; padding: 0 8px;
}
.qp-count.zero { background: var(--muted); }
.qp-controls { display: flex; gap: 8px; }
.qp-btn {
  flex: 1; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 10px; border-radius: 12px; transition: .15s;
}
.qp-btn:hover { background: #fee2e2; border-color: var(--red); color: var(--red-dark); }
.qp-btn:active { transform: scale(.97); }
.qp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-inline-end: 2px; }
.qp-list::-webkit-scrollbar { width: 8px; }
.qp-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.qp-item {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fff; transition: .15s;
}
.qp-item.speaking { border-color: var(--brand); background: var(--brand-soft); }
.qp-item.speaking .qp-tag { color: var(--brand-dark); }
.qp-item.paused { border-color: #f59e0b; background: #fffbeb; }
.qp-item.paused .qp-tag { color: #92400e; }
.qp-item.waiting { border-style: dashed; }
.qp-item-title { font-weight: 700; font-size: 14px; line-height: 1.4; }
.qp-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qp-tag { font-size: 12px; font-weight: 800; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.qp-actions { display: flex; align-items: center; gap: 10px; }
.qp-control {
  min-width: 34px; height: 32px; display: inline-grid; place-items: center;
  font-family: inherit; font-weight: 900; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 0 10px; border-radius: 9px; transition: .15s;
}
.qp-control:hover { background: var(--brand-soft); border-color: var(--brand); }
.qp-control:active { transform: scale(.96); }
.qp-control.stop { color: var(--red-dark); }
.qp-control.play { color: var(--green); }
.qp-control.delete {
  margin-inline-start: 18px;
  color: var(--red-dark);
  border-color: #fecaca;
  background: #fff7f7;
}
.qp-control.delete:hover { background: #fee2e2; border-color: var(--red); }
.qp-cancel {
  font-family: inherit; font-weight: 700; font-size: 12px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--red-dark);
  padding: 5px 10px; border-radius: 9px; transition: .15s;
}
.qp-cancel:hover { background: #fee2e2; border-color: var(--red); }
.qp-cancel:disabled { opacity: .5; cursor: not-allowed; }
.qp-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-weight: 600; }

/* عند وجود لوحة الطابور: اترك مساحة على اليسار للمحتوى */
@media (min-width: 1000px) {
  body:has(.queue-panel) .wrap { padding-inline-start: 332px; }
}
.toast {
  background: #0f172a; color: #fff; padding: 14px 22px; border-radius: 14px;
  box-shadow: var(--shadow-lg); font-weight: 700; animation: pop .25s ease;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

/* ===== شاشة المتابعة — البطاقات ===== */
.board-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.dept-badge {
  display: inline-flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 18px; box-shadow: var(--shadow);
  font-weight: 800; font-size: 20px;
}
.dept-badge .ic { font-size: 28px; }
.pending-pill {
  background: var(--red); color: #fff; border-radius: 999px; padding: 6px 16px;
  font-weight: 800; font-size: 15px;
}
.pending-pill.zero { background: var(--green); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.alert-card {
  border-radius: var(--radius); padding: 22px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.alert-card .clinic-no { font-size: 40px; font-weight: 800; line-height: 1; }
.alert-card .meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.alert-card .note { margin: 12px 0; font-size: 16px; background: #f8fafc; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--line); }
.patient-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px,1fr)); gap: 10px; margin: 12px 0 4px; background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.patient-info > div { display: flex; flex-direction: column; gap: 2px; }
.patient-info span { color: var(--muted); font-size: 12px; }
.patient-info b { font-size: 17px; }
.alert-card.pending .patient-info { background: rgba(255,255,255,.75); border-color: #fecaca; }
.alert-card .time-since { font-weight: 700; }

/* حالة معلّق: أحمر + وميض */
.alert-card.pending {
  background: linear-gradient(180deg, #fff5f5, #fff);
  border: 2px solid var(--red);
  animation: flash 1s ease-in-out infinite;
}
.alert-card.pending .clinic-no { color: var(--red-dark); }
.alert-card.pending .urgent-tag {
  position: absolute; top: 14px; left: 14px; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px;
}
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.0); border-color: var(--red); }
  50%      { box-shadow: 0 0 0 8px rgba(220,38,38,.18); border-color: #f87171; }
}

/* حالة تم الاطلاع: أخضر */
.alert-card.acknowledged {
  background: linear-gradient(180deg, var(--green-soft), #fff);
  border: 2px solid var(--green);
}
.alert-card.acknowledged .clinic-no { color: var(--green); }
.ack-banner {
  display: flex; align-items: center; gap: 8px; color: var(--green);
  font-weight: 800; font-size: 18px; margin-top: 10px;
}

.empty {
  text-align: center; color: var(--muted); padding: 60px 20px;
  background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line);
}
.empty .ic { font-size: 54px; }

/* ===== بوابة تفعيل الصوت ===== */
.sound-gate {
  position: fixed; inset: 0; background: rgba(15,23,42,.72); backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 200;
}
.sound-gate .box { background: #fff; border-radius: 24px; padding: 40px; text-align: center; max-width: 440px; box-shadow: var(--shadow-lg); }
.sound-gate .ic { font-size: 60px; }
.sound-gate h2 { margin: 14px 0 8px; }
.sound-gate p { color: var(--muted); margin: 0 0 22px; }

/* ===== السجلات ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 30px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 14px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select {
  font-family: inherit; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 15px;
}
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: right; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
th { background: #f8fafc; font-weight: 800; color: var(--muted); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.tag.pending { background: #fee2e2; color: var(--red-dark); }
.tag.acknowledged { background: var(--green-soft); color: var(--green); }
.call-history-row.pending { background: #fff1f2; }
.call-history-row.pending td { border-bottom-color: #fecdd3; }
.call-history-row.acknowledged { background: #f0fdf4; }
.call-history-row.acknowledged td { border-bottom-color: #bbf7d0; }
.call-history-row.none { background: #f8fafc; }
.view-tag {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 800; white-space: nowrap;
}
.view-tag.pending { background: #fee2e2; color: var(--red-dark); }
.view-tag.acknowledged { background: var(--green-soft); color: var(--green); }
.view-tag.none { background: #e2e8f0; color: var(--muted); }
.btn-replay {
  font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  border: 1px solid var(--brand); background: #fff; color: var(--brand-dark);
  padding: 7px 12px; border-radius: 10px; transition: .15s; white-space: nowrap;
}
.btn-replay:hover { background: var(--brand-soft); }
.btn-replay:active { transform: scale(.96); }
.btn-replay:disabled { opacity: .5; cursor: not-allowed; }

/* ===== نداء المراجعين — لوحة التحكم ===== */
.call-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: var(--surface); padding: 22px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; color: var(--muted); }
.field input, .field select {
  font-family: inherit; font-size: 17px; padding: 13px 15px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; transition: .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.call-actions { display: flex; gap: 14px; margin: 20px 0 6px; flex-wrap: wrap; }
.btn-call {
  font-family: inherit; font-weight: 800; font-size: 22px; color: #fff; cursor: pointer; border: none;
  background: linear-gradient(135deg, var(--brand), #0891b2); padding: 16px 40px; border-radius: 16px;
  box-shadow: 0 12px 26px rgba(13,148,136,.4); transition: .15s;
}
.btn-call:hover { filter: brightness(1.05); transform: translateY(-2px); }
.btn-call:active { transform: scale(.97); }
.current-call { margin-top: 24px; background: linear-gradient(180deg, var(--brand-soft), #fff); border: 1.5px solid var(--brand); border-radius: var(--radius); padding: 22px; }
.current-call h3 { margin: 0 0 14px; color: var(--brand-dark); }
.cc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; }
.cc-grid > div { display: flex; flex-direction: column; gap: 4px; }
.cc-grid span { color: var(--muted); font-size: 13px; }
.cc-grid b { font-size: 19px; }

/* ===== أزرار اختيار القسم (Pills) داخل النموذج ===== */
.dept-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.dept-pill {
  font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  padding: 11px 20px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); display: inline-flex; align-items: center; gap: 7px; transition: .15s;
}
.dept-pill span { font-size: 20px; }
.dept-pill:hover { border-color: var(--brand); }
.dept-pill.active {
  background: linear-gradient(135deg, var(--brand), #0891b2); color: #fff; border-color: transparent;
  box-shadow: 0 8px 18px rgba(13,148,136,.35);
}

/* ===== صفحة نداء المراجع — تخطيط مضغوط للوحة التحكم ===== */
.call-page {
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #f3f6f8;
}
.call-page .topbar {
  gap: 12px;
  padding: 10px 22px;
}
.call-page .logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
}
.call-page .brand-titles b { font-size: 18px; }
.call-page .brand-titles span { font-size: 12px; }
.call-page .nav-link {
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 14px;
}
.call-page .clock { font-size: 14px; }
.call-page .queue-panel {
  top: 74px;
  left: 16px;
  bottom: 16px;
  width: 270px;
  padding: 14px;
  border-radius: 14px;
  gap: 10px;
}
.call-page .qp-head { font-size: 15px; }
.call-page .qp-controls { gap: 6px; }
.call-page .qp-btn {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.call-page .qp-item {
  padding: 10px;
  border-radius: 11px;
  gap: 7px;
}
.call-page .qp-item-title { font-size: 13px; }
.call-page .qp-tag,
.call-page .qp-cancel { font-size: 12px; }
.call-wrap {
  max-width: 1360px;
  padding: 18px 20px 28px;
}
@media (min-width: 1000px) {
  body.call-page:has(.queue-panel) .call-wrap {
    width: min(1360px, calc(100% - 326px));
    max-width: none;
    margin-left: 306px;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
}
.call-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.call-heading .page-title {
  font-size: 24px;
  margin: 0 0 2px;
}
.call-heading .page-sub {
  font-size: 14px;
  margin: 0;
}
.patient-search-open { min-width: 96px; }
.patient-search-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(2, 32, 45, .07);
  padding: 14px;
  margin-bottom: 14px;
}
.patient-search-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}
.patient-search-field { min-width: 0; }
.patient-search-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.patient-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  padding-inline-end: 2px;
}
.patient-search-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  display: grid;
  gap: 8px;
}
.patient-search-card > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.patient-search-card b { color: var(--ink); }
.patient-search-card span,
.patient-search-card time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 760px) {
  .patient-search-row { grid-template-columns: 1fr; }
  .patient-search-open { width: 100%; }
}

/* ===== نافذة منبثقة عامة (تُستخدم لبحث الهوية) ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 22px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(5px);
}
.modal-backdrop.show { display: flex; }
.modal-dialog {
  width: min(720px, 100%);
  max-height: calc(100vh - 80px);
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(2, 32, 45, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop .18s ease;
}
@keyframes modalPop {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--brand-soft, #f8fafc);
}
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.modal-close {
  width: 38px; height: 38px; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); cursor: pointer; font-size: 26px; line-height: 1;
}
.modal-close:hover { border-color: var(--brand); color: var(--brand-dark); }
.modal-body { min-height: 0; padding: 16px; overflow: auto; }

kbd {
  font-family: inherit; font-size: 12px; font-weight: 800;
  background: #fff; color: var(--brand-dark);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 1px 8px; line-height: 1.7;
}

/* حالة الاطلاع داخل بطاقة البحث + شارة الحالة */
.psc-status {
  background: var(--brand-soft, #e6f6f4); color: var(--brand-dark);
  border-radius: 999px; padding: 3px 12px; font-weight: 800; font-size: 12px;
}
.patient-search-card {
  border-inline-start: 4px solid var(--line);
}
.patient-search-card.acknowledged { border-inline-start-color: var(--green); background: #f0fdf4; }
.patient-search-card.pending      { border-inline-start-color: var(--red); background: #fff1f2; }
.patient-search-card.none         { border-inline-start-color: #cbd5e1; }
.patient-search-card .view-tag { font-size: 12px; }
.patient-search-card time { color: var(--muted); font-size: 12px; font-weight: 700; }
.psc-dept { justify-content: flex-start !important; gap: 6px !important; }
.psc-dept-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.psc-dept-val { color: var(--brand-dark); font-weight: 800; font-size: 12px; }
.dept-cell { font-weight: 700; }
.dept-none { color: var(--muted); font-weight: 700; }

@media (max-width: 760px) {
  .modal-backdrop { padding: 14px; }
  .patient-search-results { grid-template-columns: 1fr; }
}

.call-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(320px, 420px);
  gap: 16px;
  align-items: stretch;
  min-height: calc(100vh - 165px);
}
.call-main-panel,
.call-side-panel {
  min-width: 0;
}
.call-main-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 165px);
  overflow: hidden;
}
.call-form {
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(2, 32, 45, .07);
}
.field-wide { grid-column: 1 / -1; }
.field { gap: 5px; }
.field label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  line-height: 1.4;
}
.field label span {
  color: var(--muted);
  font-weight: 600;
}
.field input,
.field select {
  min-height: 44px;
  font-size: 15px;
  padding: 9px 12px;
  border-radius: 11px;
}
.dept-pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.dept-pill {
  justify-content: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  white-space: nowrap;
}
.dept-pill span { font-size: 17px; }
.call-actions {
  justify-content: start;
  gap: 10px;
  margin: 12px 0 0;
}
.btn-call,
.call-page .btn {
  min-height: 46px;
  border-radius: 12px;
}
.btn-call {
  min-width: 150px;
  padding: 10px 28px;
  font-size: 18px;
  box-shadow: 0 8px 18px rgba(13,148,136,.26);
}
.call-page .btn {
  padding: 10px 18px;
  font-size: 15px;
}
.current-call {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
}
.current-call h3 {
  margin-bottom: 10px;
  font-size: 17px;
}
.cc-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.cc-grid > div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,.65);
}
.cc-grid span { font-size: 12px; }
.cc-grid b {
  font-size: 15px;
  line-height: 1.35;
}
.call-side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 165px);
  overflow: hidden;
}
#deptFeedback {
  min-width: 0;
  flex: 1;
  max-height: none;
  overflow: hidden;
  padding-inline-end: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(2, 32, 45, .07);
  min-height: 0;
}
#deptFeedback .cards {
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-inline-end: 2px;
}
.call-side-panel .section-label {
  margin: 0 0 8px;
  font-size: 15px;
}
.call-side-panel .cards {
  grid-template-columns: 1fr;
  gap: 10px;
}
.call-side-panel .alert-card {
  padding: 12px;
  border-radius: 12px;
  animation: none;
}
.call-side-panel .alert-card .clinic-no {
  font-size: 18px !important;
}
.call-side-panel .alert-card .meta,
.call-side-panel .ack-banner {
  font-size: 13px;
}
.history-panel {
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(2, 32, 45, .07);
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 12px;
}
.history-panel .table-wrap {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 515px);
  overflow: auto;
  border-radius: 10px;
  box-shadow: none;
  max-width: 100%;
}
.history-panel table {
  min-width: 720px;
}
.history-panel th,
.history-panel td {
  padding: 9px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.history-panel th {
  top: 0;
  z-index: 1;
}

/* ===== شاشة الزوار (العرض) ===== */
.display-body {
  background: linear-gradient(160deg, #0f766e 0%, #0e7490 55%, #155e75 100%);
  color: #fff; min-height: 100vh;
}
.display-body .topbar { background: rgba(255,255,255,.10); border-bottom: 1px solid rgba(255,255,255,.18); }
.display-body .brand-titles b { color: #fff; }
.display-body .brand-titles span { color: rgba(255,255,255,.8); }
.display-body .clock { color: #fff; }
.display-body .nav-link { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.25); }
.display-wrap { max-width: 1200px; margin: 0 auto; padding: 30px 22px 50px; }

.display-hero {
  background: rgba(255,255,255,.97); color: var(--ink); border-radius: 30px;
  padding: 40px; text-align: center; box-shadow: var(--shadow-lg); margin-bottom: 30px; position: relative;
}
.dh-label { font-size: 20px; font-weight: 800; color: var(--brand-dark); background: var(--brand-soft); display: inline-block; padding: 6px 22px; border-radius: 999px; }
.dh-empty { font-size: 34px; color: var(--muted); padding: 40px 0; font-weight: 700; }
.dh-name { font-size: 62px; font-weight: 800; margin: 16px 0 6px; line-height: 1.1; }
.dh-sub { font-size: 24px; color: var(--muted); }
.dh-clinic { font-size: 46px; font-weight: 800; color: var(--brand); margin: 18px 0 10px; }
.dh-clinic span { color: var(--brand-dark); }
.dh-status { display: inline-block; font-size: 22px; font-weight: 700; background: #f1f5f9; padding: 8px 26px; border-radius: 999px; }
.display-hero.ring { animation: heroRing 1.1s ease 2; }
@keyframes heroRing {
  0%,100% { box-shadow: var(--shadow-lg), 0 0 0 0 rgba(255,255,255,0); transform: scale(1); }
  40%     { box-shadow: var(--shadow-lg), 0 0 0 16px rgba(255,255,255,.35); transform: scale(1.02); }
}

.clinic-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; }
.clinic-state-card {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 20px;
  padding: 18px; text-align: center; min-height: 130px; display: flex; flex-direction: column; justify-content: center; gap: 4px;
  transition: .2s;
}
.clinic-state-card.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); }
.csc-no { font-weight: 800; font-size: 18px; opacity: .9; }
.clinic-state-card.active .csc-no { color: var(--brand-dark); opacity: 1; }
.csc-name { font-size: 26px; font-weight: 800; margin-top: 6px; }
.csc-id { color: var(--muted); font-size: 15px; }
.csc-status { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); padding: 3px 12px; border-radius: 999px; }
.csc-idle { font-size: 30px; opacity: .5; margin-top: 10px; }

/* ===== استجابة الشاشات الصغيرة ===== */
@media (max-width: 720px) {
  .roles { grid-template-columns: 1fr; }
  .clinic-grid { grid-template-columns: repeat(3, 1fr); }
  .dept-grid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .dept-btn .ic { font-size: 44px; }
  .dept-btn .name { font-size: 20px; }
  .call-form { grid-template-columns: 1fr; }
  .dh-name { font-size: 44px; }
  .dh-clinic { font-size: 34px; }
  .roles.roles-5 { grid-template-columns: 1fr; }
}
