/* برايم هيلث كير — الهوية البصرية للوحة الإدارة
   كحلي (هوية موحّدة) على خلفية فاتحة */
:root {
  --brand: #223468;
  --brand-600: #35509a;
  --brand-700: #1b2a54;
  --brand-50: #eef1f9;
  --brand-100: #dde3f4;
  --side-bg: #10182f;
  --side-2: #1b2a54;
  --gold: #35509a;
  --gold-50: #eef1f9;

  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e8ecf1;
  --border-strong: #d3dae4;
  --text: #16232b;
  --text-2: #465562;
  --text-3: #5f6b78;

  --ok: #0b7a53;     --ok-50: #e5f4eb;
  --warn: #8f5e12;   --warn-50: #fcf1dd;
  --danger: #b23a27; --danger-50: #fbe9e5;
  --info: #35509a;   --info-50: #e6eff9;
  --violet: #35509a; --violet-50: #eef1f9;
  --gray: #5d6470;   --gray-50: #eef1f3;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 47, .05), 0 6px 20px rgba(16, 24, 47, .05);
  --shadow-lg: 0 20px 60px rgba(16, 24, 47, .22);
  --font: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.z-num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.z-muted { color: var(--text-2); }
.z-faint { color: var(--text-3); font-size: 13px; }
.z-ic { flex: none; }

/* ---------- layout ---------- */
.z-app { display: flex; min-height: 100vh; }
.z-side {
  width: 272px; flex: none; background: var(--surface); color: var(--text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--border);
}
.z-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; }
.z-logo {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: #fff url("assets/logo.jpg") center / 128% no-repeat;
  font-size: 0 !important; color: transparent; box-shadow: 0 4px 12px rgba(34,52,104,.18), inset 0 0 0 1px rgba(0,0,0,.06);
}
.z-brand b { display: block; font-size: 15px; line-height: 1.3; }
.z-brand span { font-size: 12.5px; color: var(--text-3); }
.z-nav { flex: 1; overflow-y: auto; padding: 0 12px 12px; }
.z-nav-title { font-size: 12.5px; color: var(--text-3); padding: 8px 22px 6px; font-weight: 700; }
.z-nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: none; position: relative;
  color: var(--text-2); padding: 10px 12px; border-radius: 11px; cursor: pointer; text-align: start; font-size: 15px; margin-bottom: 2px;
}
.z-nav-item:hover { background: var(--gray-50); color: var(--text); }
.z-nav-item.on { background: var(--brand-50); color: var(--brand-700); font-weight: 800; }
.z-nav-item.on::after { content: ''; position: absolute; inset-inline-end: -12px; top: 50%; transform: translateY(-50%); width: 4px; height: 24px; border-radius: 4px 0 0 4px; background: var(--brand-700); }
.z-nav-count { margin-inline-start: auto; background: var(--brand-100); color: var(--brand-700); border-radius: 99px; font-size: 12px; font-weight: 800; padding: 0 8px; line-height: 20px; }
.z-nav-count.hot { background: var(--danger); color: #fff; }
.z-side-foot { padding: 14px 16px; border-top: 1px solid var(--border); }
.z-side-foot .z-user b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-side-foot .z-user span { font-size: 12px; color: var(--text-3); }
.z-side-link { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 14px; cursor: pointer; text-decoration: none; }
.z-side-link:hover, .z-side-link.on { background: var(--gray-50); color: var(--text); }
.z-scrim { display: none; }

.z-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.z-top {
  position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.z-top h1 { font-size: 19px; margin: 0; font-weight: 800; white-space: nowrap; }
.z-top-search { position: relative; flex: 1; max-width: 420px; margin-inline-start: 12px; }
.z-top-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.z-menu-btn { display: none !important; }
.z-content { padding: 26px 28px 60px; width: 100%; max-width: 1480px; }

/* ---------- page header ---------- */
.z-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.z-page-head h2 { margin: 0; font-size: 24px; font-weight: 800; }
.z-page-head p { margin: 4px 0 0; color: var(--text-2); }
.z-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.z-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent;
  border-radius: 10px; cursor: pointer; font-weight: 700; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.z-btn-md { height: 40px; padding: 0 16px; font-size: 14.5px; }
.z-btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.z-btn-icon { height: 36px; width: 36px; padding: 0; }
.z-btn-primary { background: var(--brand); color: #fff; }
.z-btn-primary:hover:not(:disabled) { background: var(--brand-700); }
.z-btn-gold { background: var(--gold); color: #fff; }
.z-btn-gold:hover:not(:disabled) { background: var(--brand); }
.z-btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.z-btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-700); }
.z-btn-ghost { background: transparent; color: var(--text-2); }
.z-btn-ghost:hover:not(:disabled) { background: var(--gray-50); color: var(--text); }
.z-btn-danger { background: var(--danger); color: #fff; }
.z-btn-danger:hover:not(:disabled) { background: #a13220; }
.z-btn-soft { background: var(--brand-50); color: var(--brand-700); }
.z-btn-soft:hover:not(:disabled) { background: var(--brand-100); }
.z-btn:disabled { opacity: .5; cursor: not-allowed; }
.z-btn:focus-visible, .z-input:focus-visible, .z-nav-item:focus-visible { outline: 3px solid rgba(34,52,104,.3); outline-offset: 1px; }
.z-block { width: 100%; }
.z-spin { width: 15px; height: 15px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: zspin .7s linear infinite; }
@keyframes zspin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.z-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.z-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.z-card-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.z-card-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.z-card-body { padding: 16px 18px 18px; }
.z-card-flush .z-card-body { padding: 12px 0 0; }

.z-grid { display: grid; gap: 16px; }
.z-kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 18px; }
/* أربع بطاقات: صف واحد أو 2×2 — لا تنكسر 3+1 */
.z-kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .z-kpis:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.z-split { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
.z-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.z-kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.z-kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.z-kpi-label { color: var(--text-2); font-size: 13.5px; }
.z-kpi-value { font-size: 26px; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.z-kpi-foot { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.tone-brand { background: var(--brand-50); color: var(--brand-700); }
.tone-ok { background: var(--ok-50); color: var(--ok); }
.tone-warn { background: var(--warn-50); color: var(--warn); }
.tone-danger { background: var(--danger-50); color: var(--danger); }
.tone-info { background: var(--info-50); color: var(--info); }
.tone-violet { background: var(--violet-50); color: var(--violet); }
.tone-gold { background: var(--gold-50); color: #1b2a54; }
.tone-gray { background: var(--gray-50); color: var(--gray); }

/* ---------- badges ---------- */
.z-badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.z-badge .z-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.z-chip {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 99px; padding: 5px 12px; font-size: 13px; cursor: pointer; font-weight: 500;
}
.z-chip b { font-weight: 800; }
.z-chip.on { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.z-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.z-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.z-field > label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.z-field > label i { color: var(--danger); font-style: normal; margin-inline-start: 2px; }
.z-field-hint { font-size: 12.5px; color: var(--text-3); }
.z-field-err { font-size: 12.5px; color: var(--danger); display: flex; gap: 5px; align-items: center; }
.z-input {
  height: 40px; width: 100%; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  padding: 0 12px; font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
textarea.z-input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
select.z-input { padding-inline-end: 8px; }
.z-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(34,52,104,.14); }
.z-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(191,63,43,.1); }
.z-input:disabled { background: var(--gray-50); color: var(--text-3); }
.z-form { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.z-form .z-span { grid-column: 1 / -1; }
.z-form-section { grid-column: 1 / -1; font-size: 13px; font-weight: 800; color: var(--brand-700); padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; }
.z-search { position: relative; }
.z-search .z-ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.z-search .z-input { padding-inline-start: 36px; }

.z-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.z-toolbar .z-search { flex: 1 1 240px; max-width: 360px; }
.z-toolbar select.z-input { width: auto; min-width: 150px; flex: 0 1 auto; }

/* ---------- table ---------- */
.z-table-wrap { overflow-x: auto; }
.z-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.z-table th { text-align: start; font-size: 12.5px; color: var(--text-2); font-weight: 700; background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.z-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.z-table tr:last-child td { border-bottom: 0; }
.z-table tbody tr:hover td { background: #fafbfd; }
.z-table tr.is-dim td { background: var(--surface-2); color: var(--text-2); }   /* صف ملغي/معطّل: خلفية مميزة بلا شفافية */
.z-table .z-end { text-align: end; }
.z-th-sort { border: 0; background: none; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: inherit; font-size: inherit; }
.z-th-sort .z-ic { opacity: .3; }
.z-th-sort.on { color: var(--brand-700); }
.z-th-sort.on .z-ic { opacity: 1; }
.z-cell-main { font-weight: 700; }
.z-cell-sub { font-size: 12.5px; color: var(--text-3); }
.z-link { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text); font-weight: 700; text-align: start; }
.z-link:hover { color: var(--brand); text-decoration: underline; }
.z-row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.z-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

/* ---------- dialog ---------- */
.z-overlay { position: fixed; inset: 0; background: rgba(16, 24, 47, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: zfade .15s; }
.z-dialog { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: zpop .18s; }
.z-dialog.lg { max-width: 780px; }
.z-dialog.xl { max-width: 960px; }
.z-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.z-dialog-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.z-dialog-head p { margin: 3px 0 0; font-size: 13.5px; color: var(--text-2); }
.z-dialog-body { padding: 18px 22px; }
.z-dialog-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
@keyframes zfade { from { opacity: 0; } }
@keyframes zpop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- menu / popover ---------- */
.z-pop-wrap { position: relative; }
.z-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 210px; padding: 6px; z-index: 50; }
.z-pop.wide { width: 360px; }
.z-pop-item { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; text-align: start; }
.z-pop-item:hover:not(:disabled) { background: var(--gray-50); }
.z-pop-item.danger { color: var(--danger); }
.z-pop-item:disabled { opacity: .45; cursor: not-allowed; }
.z-pop-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.z-pop-title { font-size: 12px; color: var(--text-3); padding: 6px 10px 4px; font-weight: 700; }

/* ---------- tabs ---------- */
.z-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; padding: 0 12px; }
.z-tab { border: 0; background: none; padding: 12px 12px 11px; cursor: pointer; font-weight: 700; color: var(--text-2); border-bottom: 2.5px solid transparent; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; font-size: 14px; }
.z-tab:hover { color: var(--text); }
.z-tab.on { color: var(--brand-700); border-bottom-color: var(--brand); }
.z-tab .z-tab-count { background: var(--gray-50); color: var(--text-2); border-radius: 99px; font-size: 12px; padding: 0 7px; }
.z-tab.on .z-tab-count { background: var(--brand-50); color: var(--brand-700); }

/* ---------- misc states ---------- */
.z-empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.z-empty .z-empty-ic { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--gray-50); color: var(--text-3); }
.z-empty h4 { margin: 0 0 4px; color: var(--text); font-size: 16px; }
.z-empty p { margin: 0 auto 14px; max-width: 380px; font-size: 14px; }
.z-locked { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 8px, #f1f3f8 8px, #f1f3f8 16px); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13.5px; }
.z-locked b { color: var(--text); display: block; font-size: 14px; }
.z-locked-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); display: grid; place-items: center; flex: none; color: var(--text-3); border: 1px solid var(--border); }
.z-mask { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12.5px; }
.z-banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; font-size: 13.5px; }
.z-skel { background: linear-gradient(90deg, #eef1f5 25%, #f4f6fa 50%, #eef1f5 75%); background-size: 200% 100%; animation: zskel 1.1s infinite; border-radius: 8px; }
@keyframes zskel { to { background-position: -200% 0; } }

.z-avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.z-avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.z-avatar.lg { width: 60px; height: 60px; font-size: 21px; }
.z-person { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- toasts ---------- */
.z-toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.z-toast { background: #10182f; color: #fff; border-radius: 12px; padding: 12px 14px; min-width: 280px; max-width: 380px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: zpop .2s; font-size: 14px; }
.z-toast b { display: block; }
.z-toast span { color: #c5cfe8; font-size: 13px; }
.z-toast .z-toast-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }

/* ---------- dashboard ---------- */
.z-hello { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: linear-gradient(120deg, var(--brand-700), var(--brand) 60%, var(--brand-600)); color: #fff; border-radius: 18px; padding: 22px 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.z-hello::after { content: ''; position: absolute; inset-inline-end: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(34,52,104,.28), transparent 70%); }
.z-hello h2 { margin: 0; font-size: 22px; font-weight: 800; }
.z-hello p { margin: 4px 0 0; color: #d6ddf0; }
.z-hello .z-actions { position: relative; z-index: 1; }
.z-hello .z-btn-secondary { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; }
.z-hello .z-btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.4); }

.z-seg { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--gray-50); }
.z-seg > span { height: 100%; }
.z-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.z-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }

.z-doc-row { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); }
.z-doc-row:first-child { border-top: 0; }
.z-doc-meta { width: 210px; flex: none; min-width: 0; }
.z-timeline { flex: 1; position: relative; height: 30px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.z-timeline .z-blk { position: absolute; top: 4px; bottom: 4px; border-radius: 5px; min-width: 4px; }
.z-timeline .z-brk { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(0,0,0,.07) 4px, rgba(0,0,0,.07) 8px); }
.z-timeline .z-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); }
.z-tl-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.z-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--border); cursor: pointer; border-inline: 0; border-bottom: 0; background: none; width: 100%; text-align: start; }
.z-alert:first-child { border-top: 0; }
.z-alert:hover { background: var(--surface-2); }
.z-alert b { display: block; font-size: 14px; }
.z-alert.is-unread { background: var(--brand-50); }   /* غير المقروء بخلفية خفيفة، والمقروء بخط عادي — بلا شفافية تُضعف التباين */
.z-alert.is-unread:hover { background: var(--brand-100); }
.z-alert.is-read b { font-weight: 600; color: var(--text-2); }
.z-alert span { font-size: 12.5px; color: var(--text-3); }
.z-alert-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }

.z-bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 8px; }
.z-bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.z-bars .z-bar { width: 100%; max-width: 34px; background: var(--brand-100); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.z-bars .z-bar.today { background: var(--gold); }
.z-bars small { font-size: 11px; color: var(--text-3); }
.z-mini { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.z-mini > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.z-mini small { color: var(--text-2); font-size: 12.5px; display: block; }
.z-mini b { font-size: 18px; }

/* ---------- appointments ---------- */
.z-time { font-weight: 800; font-size: 15px; }
.z-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.z-slot { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 9px; height: 38px; cursor: pointer; font-weight: 700; font-size: 14px; }
.z-slot:hover { border-color: var(--brand); color: var(--brand-700); }
.z-slot.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.z-summary { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 12px; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; font-size: 13.5px; }
.z-summary small { display: block; color: var(--text-2); font-size: 12px; }
.z-summary b { font-size: 14px; }
.z-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 20px; }
.z-kv small { display: block; color: var(--text-3); font-size: 12.5px; margin-bottom: 2px; }
.z-kv b { font-weight: 700; font-size: 14.5px; }
.z-picker-list { border: 1px solid var(--border); border-radius: 10px; max-height: 210px; overflow-y: auto; margin-top: 6px; }
.z-picker-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 9px 12px; cursor: pointer; text-align: start; border-bottom: 1px solid var(--border); }
.z-picker-item:last-child { border-bottom: 0; }
.z-picker-item:hover, .z-picker-item.on { background: var(--brand-50); }
.z-seg-toggle { display: inline-flex; background: var(--gray-50); border-radius: 10px; padding: 3px; gap: 3px; }
.z-seg-toggle button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--text-2); }
.z-seg-toggle button.on { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow); }

/* ---------- patient profile ---------- */
.z-profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 20px; }
.z-profile-head h2 { margin: 0; font-size: 22px; font-weight: 800; }
.z-profile-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.z-note { border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; background: var(--surface-2); }
.z-note + .z-note { margin-top: 10px; }
.z-note-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.z-timeline-list { position: relative; padding-inline-start: 22px; }
.z-timeline-list::before { content: ''; position: absolute; inset-inline-start: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.z-tl-item { position: relative; padding-bottom: 16px; }
.z-tl-item::before { content: ''; position: absolute; inset-inline-start: -20px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--brand); }

/* ---------- invoices ---------- */
.z-lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.z-lines th { text-align: start; font-size: 12.5px; color: var(--text-2); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.z-lines td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.z-totals { margin-inline-start: auto; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.z-totals > div { display: flex; justify-content: space-between; }
.z-totals .grand { font-size: 17px; font-weight: 800; border-top: 1px solid var(--border); padding-top: 8px; }

#z-print { display: none; }
.z-receipt { font-family: var(--font); color: #111; max-width: 520px; margin: 0 auto; padding: 24px; }
.z-receipt h1 { font-size: 20px; margin: 0; }
.z-receipt table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.z-receipt td, .z-receipt th { border-bottom: 1px solid #ddd; padding: 6px 4px; text-align: start; }

@media print {
  .z-app, .z-overlay, .z-toasts { display: none !important; }
  #z-print { display: block; }
  body { background: #fff; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .z-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .z-side { position: fixed; top: 0; bottom: 0; right: 0; z-index: 80; transform: translateX(105%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  .z-side.open { transform: none; }
  .z-scrim.open { display: block; position: fixed; inset: 0; background: rgba(16,24,47,.4); z-index: 70; }
  .z-menu-btn { display: inline-flex !important; }
  .z-top { padding: 0 16px; }
  .z-content { padding: 18px 16px 50px; }
}
@media (max-width: 720px) {
  .z-top h1 { display: none; }
  .z-top-search { margin: 0; }
  .z-role-label { display: none; }
  .z-form { grid-template-columns: minmax(0, 1fr); }
  .z-doc-row { flex-direction: column; align-items: stretch; }
  .z-doc-meta { width: auto; }
  .z-page-head h2 { font-size: 20px; }
  .z-kpi-value { font-size: 22px; }
  .z-hide-sm { display: none; }
  .z-pop.wide { width: min(340px, calc(100vw - 32px)); }
}

/* ================= إضافات الأقسام الجديدة ================= */
.z-dot-count { position: absolute; top: -5px; inset-inline-end: -5px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }
.z-split + .z-card, .z-split + .z-split, .z-card + .z-split { margin-top: 18px; }
.z-cal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* calendar: week */
.z-week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; padding: 14px; overflow-x: auto; }
.z-week-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 6px; min-height: 200px; display: flex; flex-direction: column; gap: 6px; }
.z-week-col.is-today { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-50); }
.z-week-col.is-off { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 8px, #f1f3f8 8px, #f1f3f8 16px); }
.z-week-head { border: 0; background: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto; text-align: start; padding: 4px 6px 6px; border-bottom: 1px solid var(--border); }
.z-week-head b { font-size: 14px; }
.z-week-head span { grid-column: 1; font-size: 12px; color: var(--text-3); }
.z-week-head small { grid-row: 1 / span 2; grid-column: 2; align-self: center; background: var(--brand-100); color: var(--brand-700); border-radius: 99px; padding: 0 8px; font-weight: 800; }
.z-week-item { border: 1px solid var(--border); border-inline-start: 4px solid; background: var(--surface); border-radius: 8px; padding: 6px 8px; text-align: start; cursor: pointer; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.z-week-item:hover { box-shadow: var(--shadow); }
.z-week-item small { color: var(--text-3); font-size: 11.5px; }

/* calendar: month */
.z-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding: 14px; }
.z-month-wd { text-align: center; font-size: 12.5px; font-weight: 800; color: var(--text-2); padding: 4px 0; }
.z-month-cell { min-height: 84px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; text-align: start; cursor: pointer; font-size: 12.5px; }
.z-month-cell:hover { border-color: var(--brand); }
.z-month-cell.is-empty { background: transparent; border: 0; cursor: default; }
.z-month-cell.is-today { border-color: var(--brand); background: var(--brand-50); }
.z-month-cell.is-off { background: var(--surface-2); }
.z-month-n { font-weight: 800; font-size: 14px; }
.z-month-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.z-month-dots i { width: 8px; height: 8px; border-radius: 50%; }

/* switch / pills / steps / choices */
.z-switch { width: 42px; height: 24px; border-radius: 99px; border: 0; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.z-switch i { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: inset-inline-start .15s; }
.z-switch.on { background: var(--brand); }
.z-switch.on i { inset-inline-start: 21px; }
.z-switch:disabled { opacity: .5; cursor: not-allowed; }
.z-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.z-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; background: var(--surface); }
.z-pill input { display: none; }
.z-pill.on { background: var(--brand-50); border-color: var(--brand); color: var(--brand-700); font-weight: 700; }
.z-steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 18px; flex-wrap: wrap; }
.z-steps li { flex: 1 1 150px; }
.z-steps button { width: 100%; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 12px; font-weight: 700; color: var(--text-3); cursor: pointer; }
.z-steps button span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); font-size: 13px; flex: none; }
.z-steps li.on button { border-color: var(--brand); color: var(--brand-700); background: var(--brand-50); }
.z-steps li.on button span { background: var(--brand); color: #fff; }
.z-steps li.done button { color: var(--text); }
.z-steps li.done button span { background: var(--ok-50); color: var(--ok); }
.z-steps button:disabled { cursor: default; }
.z-steps.small li { flex-basis: 110px; }
.z-steps.small button { padding: 7px 9px; font-size: 13px; }
.z-choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.z-choice { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer; text-align: start; }
.z-choice:hover { border-color: var(--brand); }
.z-choice.on { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 2px var(--brand-100); }
.z-choice b { display: block; }
.z-choice small { display: block; color: var(--text-3); font-size: 12.5px; }
.z-choice-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-50); color: #1b2a54; display: grid; place-items: center; flex: none; }
.z-days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.z-day { flex: none; min-width: 96px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.z-day small { color: var(--text-3); font-size: 12px; }
.z-day span { font-size: 11.5px; color: var(--ok); }
.z-day.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.z-day.on small, .z-day.on span { color: var(--brand-100); }

/* services */
.z-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; padding: 16px 18px 18px; }
.z-svc { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.z-svc.is-off { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.z-svc.is-off .z-svc-cat { filter: grayscale(1); }
.z-svc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.z-svc-cat { font-size: 12px; font-weight: 800; border-radius: 99px; padding: 2px 10px; }
.z-svc h3 { margin: 0; font-size: 16.5px; }
.z-svc p { margin: 0; color: var(--text-2); font-size: 13.5px; flex: 1; }
.z-svc-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.z-svc-meta span { display: inline-flex; gap: 5px; align-items: center; }
.z-svc-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--border); padding-top: 10px; }
.z-svc-foot > b { font-size: 18px; color: var(--brand-700); }

/* work hours */
.z-wh { display: flex; flex-direction: column; gap: 8px; }
.z-wh-day { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.z-wh-day.is-off { background: var(--surface-2); }
.z-wh-name { display: flex; align-items: center; gap: 10px; width: 130px; flex: none; }
.z-wh-times { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.z-wh-times label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.z-wh-times .z-input { width: 118px; height: 36px; }
.z-wh-table th.is-off { color: var(--danger); }
.z-slot-chip { display: inline-flex; flex-direction: column; align-items: center; background: var(--brand-50); color: var(--brand-700); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; line-height: 1.35; }
.z-slot-chip.warn { background: var(--warn-50); color: var(--warn); }

/* requests / tickets / tips / preview */
.z-req-list { display: flex; flex-direction: column; gap: 12px; }
.z-req { border: 1px solid var(--border); border-inline-start: 4px solid var(--border-strong); border-radius: 12px; padding: 14px; }
.z-req.is-pending { border-inline-start-color: var(--warn); }
.z-req.is-approved { border-inline-start-color: var(--ok); }
.z-req.is-rejected { border-inline-start-color: var(--danger); }
.z-req-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.z-tips { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: var(--text-2); }
.z-tips li { display: flex; gap: 10px; align-items: flex-start; }
.z-tips .z-ic { color: var(--brand); margin-top: 3px; }
.z-ticket { border-top: 1px solid var(--border); }
.z-ticket:first-child { border-top: 0; }
.z-ticket-head { width: 100%; border: 0; background: none; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 12px 18px; text-align: start; cursor: pointer; }
.z-ticket-head:hover { background: var(--surface-2); }
.z-ticket-body { padding: 0 18px 14px; }
.z-preview { margin-top: 14px; }
.z-preview-card { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.z-preview-card p { margin: 4px 0 0; white-space: pre-line; font-size: 13.5px; color: var(--text-2); }

/* bars */
.z-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.z-hbars li > div:first-child { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; gap: 8px; }
.z-hbars li i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }
.z-hbars li.is-zero { color: var(--text-3); }
.z-hbar-track { height: 9px; background: var(--gray-50); border-radius: 99px; overflow: hidden; }
.z-hbar-track span { display: block; height: 100%; border-radius: 99px; }

/* notifications */
.z-ncats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 18px; }
.z-ncat { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer; text-align: start; }
.z-ncat b { display: block; font-size: 14px; }
.z-ncat small { color: var(--text-3); font-size: 12px; }
.z-ncat.on { border-color: var(--brand); background: var(--brand-50); }
.z-notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-top: 1px solid var(--border); cursor: pointer; }
.z-notif:first-child { border-top: 0; }
.z-notif:hover { background: var(--surface-2); }
.z-notif.is-unread { background: #fafbfd; }
.z-notif-title { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.z-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; }
.z-src { border: 1px solid; border-radius: 99px; padding: 0 8px; margin-inline-start: 8px; font-size: 11.5px; font-weight: 700; }

/* roles */
.z-perm td, .z-perm th { text-align: center; }
.z-perm td:first-child, .z-perm th:first-child { text-align: start; }
.z-perm input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.z-perm tr.is-fin td { background: var(--gold-50); }
details.z-card > summary { list-style: none; }
details.z-card > summary::-webkit-details-marker { display: none; }

/* print (reports) */
.z-print-head { display: none; }
@media print {
  body.z-print-page .z-app { display: block !important; }
  body.z-print-page .z-side, body.z-print-page .z-top, body.z-print-page .no-print, body.z-print-page .z-page-head .z-actions, body.z-print-page .z-toasts { display: none !important; }
  body.z-print-page .z-print-head { display: block; margin-bottom: 12px; }
  body.z-print-page .z-content { padding: 0; max-width: none; }
  body.z-print-page .z-card { box-shadow: none; break-inside: avoid; }
  body.z-print-page .z-split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .z-week { grid-template-columns: repeat(7, 150px); }
  .z-month-cell { min-height: 58px; padding: 4px; }
  .z-month-cell b { font-size: 11px; }
  .z-wh-name { width: 100%; }
}
.z-seg-toggle { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 720px) {
  .z-cal-bar b { min-width: 0 !important; font-size: 13.5px; }
  .z-cal-bar .z-actions { flex-wrap: nowrap; }
}

/* ===== الرئيسية: ترتيب الصفوف ===== */
.z-dash-top { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: stretch; margin-top: 18px; }
.z-dash-top > .z-card { height: 100%; }
.z-dash-row { margin-top: 18px; }
.z-dash-status { padding: 4px 20px 14px; border-bottom: 1px solid var(--border); }
.z-dash-status .z-legend { margin-top: 10px; }
.z-fin { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: end; }
.z-fin .z-bars { margin-top: 8px; }
@media (max-width: 1024px) { .z-dash-top, .z-fin { grid-template-columns: minmax(0, 1fr); } }

/* ===== مواعيد العمل: فترات متعددة + 24 ساعة ===== */
.z-wh-day { align-items: flex-start; }
.z-wh-name { padding-top: 6px; }
.z-wh-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.z-wh-24 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.z-wh-pn { font-size: 12.5px; color: var(--text-3); min-width: 48px; }
.z-slot-chip span + span { margin-top: 2px; }
.z-dweek { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.z-dweek-day { border: 1px solid var(--border); border-radius: 11px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.z-dweek-day b { font-size: 13.5px; }
.z-dweek-day.on { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.z-dweek-day.off { background: var(--surface-2); color: var(--text-3); }
.z-dweek-day small { color: var(--warn); font-size: 11.5px; }

/* قسم اختياري قابل للطي داخل النماذج */
.z-more { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.z-more summary { cursor: pointer; font-weight: 700; color: var(--brand-700); font-size: 14px; }

/* =====================================================================
   إعادة التصميم (2026-10-07): تجميع القائمة، التنقل السفلي، الجداول كبطاقات،
   شبكة الأوقات، صفحة الحجز، الرئيسية، النماذج
   ===================================================================== */
.z-nav-group + .z-nav-group { margin-top: 6px; }
.z-nav-group .z-nav-title { padding: 12px 12px 4px; font-size: 11.5px; letter-spacing: .02em; }
.z-nav-item { padding: 9px 12px; font-size: 14.5px; }

/* التنقل السفلي (موبايل) */
.z-bnav { display: none; }
@media (max-width: 720px) {
  .z-bnav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(16, 24, 47, .06);
  }
  .z-bn-item { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 4px 0; min-height: 48px; cursor: pointer; }
  .z-bn-item.on { color: var(--brand-700); }
  .z-bn-ic { position: relative; display: grid; place-items: center; width: 44px; height: 28px; border-radius: 14px; }
  .z-bn-item.on .z-bn-ic { background: var(--brand-50); }
  .z-bn-ic i { position: absolute; top: -4px; inset-inline-end: 0; background: var(--brand); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
  .z-bn-fab { justify-self: center; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--gold); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 6px 16px rgba(34, 52, 104, .4); cursor: pointer; }
  .z-content { padding-bottom: 96px; }
  .z-toasts { bottom: 84px; inset-inline: 12px; }
  .z-toast { min-width: 0; max-width: none; }
}

/* الجداول ← بطاقات على الموبايل */
@media (max-width: 720px) {
  table[data-cards] { display: block; }
  table[data-cards] thead { display: none; }
  table[data-cards] tbody { display: block; }
  table[data-cards] tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table[data-cards] tr:last-child { border-bottom: 0; }
  table[data-cards] td { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; justify-items: end; padding: 4px 0; border: 0; text-align: end; width: 100%; }
  table[data-cards] td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 3; align-self: start; justify-self: start; color: var(--text-3); font-size: 12.5px; font-weight: 700; text-align: start; }
  table[data-cards] td > * { grid-column: 2; }
  table[data-cards] td:first-child { display: flex; justify-content: flex-start; text-align: start; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px dashed var(--border); font-size: 15px; }
  table[data-cards] td:first-child::before, table[data-cards] td[data-label=""]::before, table[data-cards] td:has(.z-row-actions)::before { display: none; }
  table[data-cards] td:empty { display: none; }
  table[data-cards] td:has(.z-row-actions) { display: flex; justify-content: flex-end; padding-top: 8px; }
  table[data-cards] .z-row-actions { flex-wrap: wrap; }
  table[data-cards] tbody tr:hover td { background: none; }
  .z-toolbar { padding: 12px 14px; }
  .z-toolbar .z-search { max-width: none; flex-basis: 100%; }
  .z-toolbar select.z-input { flex: 1 1 140px; min-width: 0; }
  .z-card-head { flex-wrap: wrap; }
  .z-page-head .z-actions { width: 100%; }
  .z-page-head .z-actions .z-btn { flex: 1 1 auto; }
  .z-pager { flex-wrap: wrap; }
  .z-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .z-kpi { padding: 12px; gap: 10px; }
  .z-kpi-ic { width: 36px; height: 36px; }
  .z-kpi-foot { display: none; }
  .z-split { gap: 14px; }
  .z-tabs { padding: 0 6px; }
  .z-btn-md, .z-input, .z-btn-icon { min-height: 44px; }
  .z-btn-sm { min-height: 36px; }
  .z-top { height: 60px; gap: 8px; }
}

/* النوافذ على الموبايل: ورقة سفلية بدل نافذة عائمة تخرج عن الشاشة */
@media (max-width: 720px) {
  .z-overlay { padding: 0; align-items: flex-end; }
  .z-dialog, .z-dialog.lg, .z-dialog.xl { max-width: none; border-radius: 18px 18px 0 0; max-height: 94vh; display: flex; flex-direction: column; animation: zsheet .22s; }
  .z-dialog-body { overflow-y: auto; flex: 1; padding: 16px 16px; }
  .z-dialog-head { padding: 16px 16px 0; }
  .z-dialog-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; }
  .z-dialog-foot .z-btn { flex: 1; }
}
@keyframes zsheet { from { transform: translateY(40px); opacity: 0; } }

/* الإشعارات المؤقتة: شريط ملوّن حسب النوع */
.z-toast { border-inline-start: 4px solid var(--ok); }
.z-toast:has(.tone-danger) { border-inline-start-color: #e0705c; }
.z-toast:has(.tone-warn) { border-inline-start-color: #35509a; }
.z-toast:has(.tone-info) { border-inline-start-color: #8fa6e0; }

/* ---------- الرئيسية ---------- */
.z-dh { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.z-dh h2 { margin: 0; font-size: 22px; font-weight: 800; }
.z-dh p { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.z-qa { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 10px; margin-bottom: 18px; }
.z-qa-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 11px 13px; cursor: pointer; text-align: start; font-weight: 700; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.z-qa-item:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.z-qa-item.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.z-qa-item .z-qa-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand-700); }
.z-qa-item.primary .z-qa-ic { background: rgba(255,255,255,.18); color: #fff; }
@media (min-width: 721px) and (max-width: 1180px) { .z-qa-item { flex-direction: column; justify-content: center; text-align: center; gap: 6px; padding: 12px 8px; } }   /* عرض متوسط: الأيقونة فوق النص حتى يبقى سطرًا واحدًا */
.z-sched-row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); }
.z-sched-row:first-child { border-top: 0; }
.z-sched-row.is-now { background: var(--brand-50); }
.z-sched-row.is-done { background: var(--surface-2); }
.z-sched-time { width: 74px; flex: none; font-weight: 800; font-size: 14.5px; }
.z-sched-time small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.z-sched-main { flex: 1; min-width: 0; }
.z-sched-main b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-sched-main span { font-size: 12.5px; color: var(--text-3); }
.z-sched-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
@media (max-width: 720px) { .z-sched-row { padding: 10px 14px; gap: 10px; flex-wrap: wrap; } .z-sched-time { width: 62px; } .z-sched-act { margin-inline-start: auto; } }

/* ---------- صفحة الحجز (شاشة واحدة) ---------- */
.z-bk { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.z-bk-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.z-bk-side { position: sticky; top: 82px; }
.z-bk-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.z-bk-step.is-locked { background: var(--surface-2); box-shadow: none; border-style: dashed; }   /* خطوة لم تُفتح بعد: تمييز بالخلفية لا بالشفافية حتى يبقى النص مقروءًا */
.z-bk-step.is-locked .z-bk-head h3 { color: var(--text-2); }
.z-bk-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; width: 100%; border: 0; background: none; text-align: start; }
button.z-bk-head { cursor: pointer; }
.z-bk-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); color: var(--text-2); font-weight: 800; font-size: 13.5px; flex: none; }
.z-bk-step.is-active .z-bk-n { background: var(--brand); color: #fff; }
.z-bk-step.is-done .z-bk-n { background: var(--ok-50); color: var(--ok); }
.z-bk-head > span:nth-child(2) { min-width: 0; flex: 1; }
.z-bk-head h3 { margin: 0; font-size: 15.5px; font-weight: 800; }
.z-bk-head small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-bk-head .z-bk-edit { color: var(--brand-700); font-size: 13px; font-weight: 700; flex: none; }
.z-bk-body { padding: 2px 18px 18px; }
.z-bk-pick { display: flex; align-items: center; gap: 10px; border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: 12px; padding: 10px 12px; }
.z-bk-pick > span:first-child { flex: 1; min-width: 0; }
.z-bk-res { border: 1px solid var(--border); border-radius: 12px; margin-top: 8px; overflow: hidden; max-height: 280px; overflow-y: auto; }
.z-bk-res button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); padding: 10px 12px; cursor: pointer; text-align: start; min-height: 48px; }
.z-bk-res button:last-child { border-bottom: 0; }
.z-bk-res button:hover { background: var(--brand-50); }
.z-bk-sum dl { margin: 0; display: grid; gap: 12px; }
.z-bk-sum dt { font-size: 12px; color: var(--text-3); }
.z-bk-sum dd { margin: 1px 0 0; font-weight: 700; }
.z-bk-sum .z-bk-empty { color: var(--text-3); font-weight: 500; }
.z-bk-bar { display: none; }
@media (max-width: 1024px) {
  .z-bk { grid-template-columns: minmax(0, 1fr); }
  .z-bk-side { position: static; order: 2; }
}
@media (max-width: 720px) {
  .z-bk-side { display: none; }
  .z-bk-bar { display: flex; align-items: center; gap: 10px; position: fixed; inset-inline: 0; bottom: 64px; z-index: 55; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; box-shadow: 0 -6px 18px rgba(16,24,47,.08); }
  .z-bk-bar > div { flex: 1; min-width: 0; font-size: 13px; }
  .z-bk-bar b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .z-bk-body { padding: 2px 14px 16px; }
  .z-bk-head { padding: 12px 14px; }
  .z-content:has(.z-bk-bar) { padding-bottom: 150px; }
}

/* شبكة الأوقات: متاح / محجوز / غير متاح / ماضٍ / المحدد */
.z-sg { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.z-sg-cell { height: 42px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; display: grid; place-items: center; line-height: 1.1; }
.z-sg-cell:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-700); background: var(--brand-50); }
.z-sg-cell.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(34,52,104,.3); }
.z-sg-cell:disabled { cursor: not-allowed; background: var(--surface-2); border-style: dashed; color: var(--text-3); font-weight: 500; }
.z-sg-cell.booked:disabled { background: var(--danger-50); border: 1px solid #f0cfc7; color: var(--danger); text-decoration: line-through; }
.z-sg-cell.past:disabled { opacity: .5; text-decoration: line-through; }
.z-sg-cell.patient:disabled { background: var(--warn-50); border: 1px dashed #d3dae4; color: var(--warn); }
.z-sg-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--text-2); align-items: center; }
.z-sg-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: 5px; vertical-align: -2px; border: 1px solid var(--border-strong); background: var(--surface); }
.z-sg-legend i.booked { background: var(--danger-50); border-color: #f0cfc7; }
.z-sg-legend i.past { background: var(--surface-2); border-style: dashed; }
.z-sg-legend i.on { background: var(--brand); border-color: var(--brand); }
.z-sg-legend i.patient { background: var(--warn-50); border-color: #d3dae4; }
.z-day { min-height: 64px; }

/* ---------- النماذج: أقسام واضحة ---------- */
.z-fsec { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.z-fsec:first-child { margin-top: 0; }
.z-fsec h4 { margin: 0; font-size: 13px; font-weight: 800; color: var(--brand-700); white-space: nowrap; }
.z-fsec::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.z-more { grid-column: 1 / -1; margin-top: 4px; }
.z-more[open] > summary { margin-bottom: 14px; }
.z-more > .z-form { margin-top: 12px; }

@media (max-width: 720px) {
  .z-qa { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .z-qa-item.primary:nth-last-child(odd) { grid-column: 1 / -1; }   /* عدد فردي: الحجز بعرض كامل والباقي أزواج */
  .z-qa-item { padding: 8px 10px; font-size: 13.5px; gap: 8px; }
  .z-qa-item .z-qa-ic { width: 30px; height: 30px; }
  .z-dh h2 { font-size: 19px; }
  .z-dh { margin-bottom: 12px; }
}

/* خلية جدول رقمية: لا تتحول إلى inline-block فتكسر تخطيط الجدول */
@media (min-width: 721px) { .z-table td.z-num, .z-table th.z-num, .z-lines td.z-num { display: table-cell; direction: rtl; unicode-bidi: normal; } }

/* سطر ثانوي رقمي (هاتف/رقم ملف) يبدأ في سطر مستقل تحت الاسم */
.z-cell-sub.z-num { display: block; width: fit-content; }

/* ملف المريض */
.z-ph { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 18px 20px; }
.z-ph-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.z-ph-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; grid-column: 1 / -1; }
.z-ph-fact { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; }
.z-ph-fact small { display: block; color: var(--text-3); font-size: 12px; }
.z-ph-fact b { font-size: 14.5px; }
@media (max-width: 720px) { .z-ph { padding: 14px; gap: 12px; } .z-ph-actions .z-btn { flex: 1 1 calc(50% - 8px); } }

/* الحجز: اختيار الخدمة بشكل مضغوط */
.z-bk-filter { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 8px; margin-bottom: 10px; }
.z-bk-filter > :only-child { grid-column: 1 / -1; }
.z-bk-list { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 300px; overflow-y: auto; }
.z-bk-item { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.z-bk-item:last-child { border-bottom: 0; }
.z-bk-item:hover { background: var(--surface-2); }
.z-bk-item.on { background: var(--brand-50); box-shadow: inset -3px 0 0 var(--brand); }
.z-bk-item b { font-size: 14px; color: var(--text); }
.z-bk-item small { display: block; font-size: 12px; color: var(--text-3); }
.z-bk-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.z-bk-picked { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: var(--radius-sm); }
.z-bk-picked small { display: block; font-size: 12px; color: var(--text-2); }
@media (max-width: 720px) { .z-bk-filter { grid-template-columns: 1fr; } }

/* موبايل: صفوف الفلاتر (chips) تُمرَّر أفقيًا بدل أن تلتف في عدة أسطر */
@media (max-width: 720px) {
  .z-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin-inline: -2px; padding-inline: 2px; }
  .z-chips::-webkit-scrollbar { display: none; }
  .z-chips > * { flex: none; }
}

/* =====================================================================
   المواعيد + حجز موعد — نفس تصميم وترتيب «التميز» (schedule.jsx / today.jsx / booking.jsx)
   ===================================================================== */
/* الفلاتر + التنقل بالتاريخ + نوع العرض */
.z-fbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.z-fbar > .z-field > label { font-weight: 700; color: var(--text); }
.z-cal-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.z-date-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.z-date-nav strong { font-size: 16px; min-width: min(170px, 40vw); text-align: center; }
.z-icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.z-icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.z-date-in { width: auto; min-width: 150px; height: 36px; }
.z-view-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.z-cal-body { padding: 18px 20px; }

/* جدول الخانات: الوقت عمودي والأطباء أعمدة */
.z-tg-wrap { min-width: 0; }
.z-tg-summary { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; color: var(--text-2); font-size: 14px; }
.z-tg-summary span { display: inline-flex; align-items: center; gap: 5px; }
.z-tg-scroll { overflow-x: auto; overflow-y: visible; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.z-tg { display: grid; min-width: min-content; }
.z-tg-corner, .z-tg-head { position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.z-tg-corner { inset-inline-start: 0; z-index: 6; }
.z-tg-head { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; border-inline-start: 1px solid var(--border); min-width: 0; }
.z-tg-head strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tg-head > span { font-size: 13px; color: var(--text-3); }
.z-tg-head.is-today { background: var(--brand-50); }
.z-tg-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--warn); font-weight: 700; }
.z-tg-axis { position: sticky; inset-inline-start: 0; z-index: 3; background: var(--surface-2); }
.z-tg-axis-t { display: flex; align-items: flex-start; justify-content: center; padding-top: 5px; font-size: 12px; color: var(--text-3); border-bottom: 1px dashed var(--border); }
.z-tg-col { position: relative; border-inline-start: 1px solid var(--border); min-width: 0; }
.z-tg-cell { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; border: 0; border-bottom: 1px dashed var(--border); font: inherit; font-size: 12.5px; padding: 0; background: transparent; }
.z-tg-cell.is-free { color: var(--ok); cursor: pointer; font-weight: 700; }
.z-tg-cell.is-free:hover { background: var(--ok-50); }
.z-tg-cell.is-free.is-static { cursor: default; }
.z-tg-cell.is-free.is-static:hover { background: transparent; }
.z-tg-cell.is-past { background: repeating-linear-gradient(135deg, #f7f8fb, #f7f8fb 6px, #eff1f5 6px, #eff1f5 12px); }
.z-tg-cell.is-off { color: var(--warn); font-size: 11.5px; background: repeating-linear-gradient(135deg, #fff8ea, #fff8ea 6px, #fdf2dd 6px, #fdf2dd 12px); }
.z-tg-now { position: absolute; inset-inline: 0; height: 0; border-top: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.z-tg-now::before { content: ""; position: absolute; inset-inline-end: -1px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.z-tg-appt { position: absolute; inset-inline-start: 3px; width: calc(100% - 6px); z-index: 1; display: flex; flex-direction: column; gap: 1px; text-align: start; overflow: hidden; padding: 4px 8px; border-radius: 9px; border: 1px solid; border-inline-start-width: 4px; font: inherit; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 47, .08); line-height: 1.3; }
.z-tg-appt:hover { filter: brightness(.97); z-index: 3; }
.z-tg-appt-top { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; }
.z-tg-appt-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tg-appt-svc, .z-tg-appt-time { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tg-appt.is-booked { background: var(--brand-50); border-color: #c9d2ea; border-inline-start-color: var(--brand); color: var(--brand-700); }
.z-tg-appt.is-arrived { background: #fff4d6; border-color: #f2dc9b; border-inline-start-color: #d99a00; color: #6b4b00; }
.z-tg-appt.is-noshow { background: var(--danger-50); border-color: #f3c2bd; border-inline-start-color: var(--danger); color: #8a2c22; }
.z-tg-appt.is-current { box-shadow: 0 0 0 2px var(--danger), 0 2px 6px rgba(178, 58, 39, .3); }
.z-tg-appt.is-dim { opacity: .3; }
.z-tg-appt.is-hit { box-shadow: 0 0 0 2px #f59e0b, 0 2px 8px rgba(245, 158, 11, .35); }
.z-tg-badge { margin-inline-start: auto; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: #fff; border: 1px solid currentColor; }
.z-tg-badge.is-now { background: var(--danger); color: #fff; border-color: var(--danger); }
.z-tg-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.z-tg-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; border: 1px solid #c5ccd6; }
.z-tg-sw.is-free { background: #fff; border-color: var(--ok); }
.z-tg-sw.is-booked { background: #c9d2ea; }
.z-tg-sw.is-arrived { background: #f2dc9b; }
.z-tg-sw.is-noshow { background: #f3c2bd; }
.z-tg-sw.is-off { background: #fdf2dd; }
.z-tg-docs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.z-tg-doc { flex: none; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13.5px; cursor: pointer; }
.z-tg-doc.on { background: var(--brand); color: #fff; border-color: transparent; font-weight: 700; }
.z-ap-results { border: 1px solid #f2dc9b; background: #fffaf0; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.z-ap-results button { display: flex; width: 100%; gap: 10px; align-items: center; justify-content: space-between; border: 0; background: transparent; font: inherit; padding: 6px 4px; cursor: pointer; border-radius: 8px; text-align: start; flex-wrap: wrap; }
.z-ap-results button:hover { background: #fff1d1; }

/* كل مواعيد اليوم */
.z-tl-title { font-weight: 800; font-size: 16px; margin-bottom: 10px; }
.z-cal-body .z-timeline { display: flex; flex-direction: column; gap: 10px; height: auto; overflow: visible; background: none; border: 0; border-radius: 0; }
.z-tl-row { display: flex; gap: 12px; align-items: stretch; }
.z-tl-time { width: 64px; flex: none; padding-top: 14px; font-size: 14px; color: var(--text-2); font-weight: 700; text-align: center; }
.z-tl-card { flex: 1; min-width: 0; border-radius: var(--radius); padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-inline-start: 4px solid var(--brand); display: flex; align-items: center; gap: 10px; }
.z-tl-card.st-attended { border-inline-start-color: #d99a00; }
.z-tl-card.st-no_show { border-inline-start-color: var(--gray); }
.z-tl-card.st-cancelled { border-inline-start-color: var(--danger); }
.z-tl-card.st-cancelled .z-tl-info strong { text-decoration: line-through; }
.z-tl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.z-tl-info strong { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tl-info span { font-size: 13.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tl-count { display: inline-flex; align-items: center; gap: 4px; flex: none; white-space: nowrap; font-size: 13px; color: var(--text-3); }

/* نافذة تفاصيل الموعد: صفوف الإجراءات */
.z-ad-foot { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.z-ad-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }

/* معالج الحجز */
.z-wz .z-field { margin-bottom: 14px; }
.z-wz-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.z-wz-dot { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 14.5px; }
.z-wz-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--gray-50); color: var(--text-2); font-size: 13.5px; font-weight: 800; flex: none; }
.z-wz-dot.active { color: var(--text); font-weight: 700; }
.z-wz-dot.active .z-wz-n { background: var(--brand); color: #fff; }
.z-wz-dot.done .z-wz-n { background: var(--ok); color: #fff; }
.z-wz-sep { width: 18px; height: 2px; background: var(--border); border-radius: 2px; }
.z-wz-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: thin; }
.z-wz-tab { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.z-wz-tab .z-num { font-size: 12.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); }
.z-wz-tab:hover { border-color: var(--brand); }
.z-wz-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.z-wz-tab.active .z-num { background: rgba(255, 255, 255, .2); }
.z-wz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.z-wz-choice { width: 100%; text-align: start; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; gap: 12px; align-items: center; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.z-wz-choice:hover { border-color: var(--brand-100); }
.z-wz-choice.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.z-wz-choice strong { display: block; font-size: 15.5px; color: var(--text); }
.z-wz-choice span span { font-size: 13.5px; color: var(--text-3); }
.z-wz-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-700); flex: none; }
.z-wz-price { margin-inline-start: auto; font-weight: 800; color: var(--brand-700); flex: none; }
.z-wz-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 8px; }
.z-wz-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: inherit; cursor: pointer; }
.z-wz-day strong { font-size: 14.5px; }
.z-wz-day span { font-size: 12.5px; color: var(--text-3); }
.z-wz-day small { font-size: 12px; color: var(--ok); font-weight: 700; }
.z-wz-day:hover { border-color: var(--brand-100); }
.z-wz-day.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.z-wz-day.selected span, .z-wz-day.selected small { color: #fff; }
.z-wz-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.z-wz-slot { height: 46px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.z-wz-slot:hover { border-color: var(--brand-100); }
.z-wz-slot.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.z-wz-slot.is-taken { background: var(--surface-2); color: var(--text-3); border-style: dashed; cursor: not-allowed; text-decoration: line-through; }
.z-wz-daybox { margin-top: 4px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.z-wz-daybox-h { font-weight: 800; margin-bottom: 8px; }
.z-wz-kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.z-wz-review { display: flex; flex-direction: column; margin: 0; }
.z-wz-review > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.z-wz-review > div:last-child { border-bottom: 0; }
.z-wz-review dt { color: var(--text-3); }
.z-wz-review dd { margin: 0; font-weight: 700; text-align: end; }
.z-wz-success { text-align: center; }
.z-wz-success .mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 4px auto 12px; background: var(--ok-50); color: var(--ok); }
.z-wz-success h2 { margin: 0 0 14px; font-size: 20px; }
.z-wz-success .z-wz-review { text-align: start; max-width: 520px; margin: 0 auto; }
.z-wz-foot { display: flex; gap: 10px; align-items: center; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.z-btn.is-soft-disabled { opacity: .55; }

@media (max-width: 720px) {
  .z-fbar { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 10px; }
  .z-cal-head { padding: 12px 14px; }
  .z-cal-body { padding: 14px; }
  .z-date-nav strong { min-width: 0; flex: 1; }
  .z-tg-scroll { max-height: none; }
  .z-tg-head strong { font-size: 13.5px; }
  .z-tl-row { gap: 8px; }
  .z-tl-time { width: 50px; font-size: 13px; }
  .z-tl-card { flex-wrap: wrap; }
  .z-tl-info { flex-basis: 100%; }
  .z-wz-grid { grid-template-columns: minmax(0, 1fr); }
  .z-wz-label { display: none; }
  .z-wz-dot.active .z-wz-label { display: inline; }
}
.z-tg-appt.is-tiny { justify-content: center; padding-block: 2px; }
.z-tg-appt-line { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12.5px; }
.z-tg-appt-line strong { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-tg-appt-line .z-num { flex: none; font-size: 11.5px; }
.z-tg-appt.is-small { justify-content: center; gap: 2px; }
.z-tg-appt-sub { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- صفحة الدفع عند تأكيد الحضور (Checkout) ---------- */
.z-co-amount { background: var(--brand); color: #fff; border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.z-co-amount small { opacity: .9; font-size: 13px; }
.z-co-amount b { font-size: 32px; font-weight: 800; }
.z-co-amount span { font-size: 13px; color: #dfe6f7; }
.z-co-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.z-co-m { display: flex; align-items: center; gap: 8px; padding: 12px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); font: inherit; color: var(--text); cursor: pointer; text-align: start; }
.z-co-m:hover { border-color: var(--brand); }
.z-co-m.on { border-color: var(--brand); background: var(--brand-soft, #e8ecf7); box-shadow: 0 0 0 2px var(--brand) inset; }
.z-co-ic { font-size: 20px; }
.z-co-m b { font-size: 14px; }
@media (max-width: 720px) { .z-co-methods { grid-template-columns: 1fr 1fr; } }

/* شرح كل مربع في شاشة الصلاحيات */
.z-perm .z-perm-cell { vertical-align: top; }
.z-perm .z-perm-what { font-size: 11.5px; color: var(--text-2); line-height: 1.4; margin-top: 4px; max-width: 150px; margin-inline: auto; }

/* ---------- الرئيسية (بنفس ترتيب «التميز») ---------- */
.z-home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.z-home-head h2 { margin: 0; font-size: 22px; }
.z-home-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; }
.z-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.z-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; font: inherit; color: var(--text); text-align: start; box-shadow: 0 1px 2px rgba(16, 24, 47, .04); }
.z-tile:disabled { cursor: default; color: var(--text); }
.z-tile.is-link { cursor: pointer; transition: border-color .15s, transform .15s; }
.z-tile.is-link:hover { border-color: var(--brand); transform: translateY(-1px); }
.z-tile-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 6px; background: var(--surface-2); color: var(--brand); }
.z-tile-ic.tone-ok { background: #e6f4ee; color: var(--ok); }
.z-tile-ic.tone-warn { background: #fbf1e1; color: var(--warn); }
.z-tile-ic.tone-danger { background: #fbe9e6; color: var(--danger); }
.z-tile-ic.tone-gray { background: var(--surface-2); color: var(--gray); }
.z-tile b { font-size: 22px; font-weight: 800; line-height: 1.2; }
.z-tile small { color: var(--text-2); font-size: 13px; }
.z-tile em { font-style: normal; color: var(--text-3); font-size: 12px; }
.z-home-banner { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; margin-bottom: 14px; border: 1px solid #f0d9ae; background: #fdf6e7; color: var(--warn); border-radius: 12px; font: inherit; cursor: pointer; text-align: start; }
.z-home-banner-go { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--text); white-space: nowrap; }
.z-home-date, .z-home-doc { width: auto; height: 32px; padding: 0 8px; font-size: 13px; }
.z-home-doc { max-width: 170px; }
.z-home-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.z-home-filters > button[type=button]:not([class*=z-btn]) { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; }
.z-home-filters > button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.z-home-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.z-latest-act { margin-top: 14px; }
.z-latest-act > * { width: 100%; justify-content: center; }
@media (max-width: 720px) {
  .z-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .z-tile { padding: 12px; }
  .z-tile b { font-size: 18px; }
  .z-home-head > button { width: 100%; justify-content: center; }
}

/* ---------- الأجهزة: Safe Areas (iPhone notch/الشريط السفلي) + أهداف لمس مريحة (2026-10-12) ----------
   viewport-fit=cover في كل الصفحات، فالحواف تُحسب هنا: أعلى عند التشغيل كتطبيق مثبّت، وجوانب في الوضع الأفقي. */
html { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
.z-top, .m-top, .s-header { padding-top: env(safe-area-inset-top); }
.z-top { height: calc(66px + env(safe-area-inset-top)); }
.z-side, .m-side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.l-mbar { bottom: calc(12px + env(safe-area-inset-bottom)); }
@media (max-width: 720px) {
  .z-top { height: calc(60px + env(safe-area-inset-top)); }
  .z-bk-bar { bottom: calc(64px + env(safe-area-inset-bottom)); }
  .z-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .z-content:has(.z-bk-bar) { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}
/* شاشات اللمس: لا هدف أصغر من ~40px (أزرار الفلاتر والتبديل والتبويبات والروابط المستقلة) */
@media (pointer: coarse) {
  .z-chip, .z-seg-toggle button, .z-tg-doc, .z-home-filters > button, .z-tab { min-height: 40px; }
  .z-th-sort { padding-block: 10px; margin-block: -10px; }
  .z-link, a.z-num { padding-block: 9px; } /* عنصر inline: الحشوة تكبّر منطقة اللمس دون تغيير التخطيط */
  .z-switch::after { content: ''; position: absolute; inset: -10px -6px; }
  .l-footer a, .l-footer button { display: inline-flex; align-items: center; min-height: 40px; }
  .s-auth a:not([class*=btn]) { min-height: 40px; display: inline-flex; align-items: center; }
  input, select, textarea { font-size: max(16px, 1em); } /* iOS لا يكبّر الصفحة عند التركيز */
}

/* ---------- PWA: خطوات التثبيت + شريط التحديث ---------- */
.z-steps { margin: 0; padding-inline-start: 20px; line-height: 2; color: var(--text-2); }
.z-kbd { display: inline-block; min-width: 22px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); text-align: center; font-weight: 700; color: var(--text); }
.z-update { position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 300; max-width: 460px; margin-inline: auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); }
.z-update span { flex: 1; font-weight: 700; }
@media (max-width: 720px) { .z-update { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* ---------- العروض والإشعارات: اختيار القنوات ---------- */
.z-ch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.z-ch { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.z-ch.on { border-color: var(--brand); background: var(--surface-2); }
.z-ch input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--brand); }
.z-ch b { display: block; font-size: 14px; }
.z-ch small { color: var(--text-2); font-size: 12.5px; }

/* زر «تثبيت التطبيق» في الهيدر: الاسم يظهر على الشاشات العريضة فقط، وما دونها أيقونة + tooltip حتى لا يضيق الهيدر */
.s-inst-label { display: none; }
@media (min-width: 1081px) { .s-header .s-wrap { max-width: 1420px; } }
@media (min-width: 1500px) { .s-inst-label { display: inline; } }

/* ---------- شريط الدخول/التسجيل/التثبيت المكتوب (تحت الهيدر، يمرّ مع الصفحة) ----------
   موبايل (≤760): دخول + تسجيل + تثبيت مكتوبة. تابلت (761–1080): زر التثبيت فقط (الدخول والتسجيل ظاهران في الهيدر). */
.s-mbar { display: none; }
.s-inst-label.always { display: inline; }
@media (max-width: 1080px) {
  .s-hide-md { display: none !important; }
  .s-mbar { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--border); }
  .s-mbar > .z-btn, .s-mbar > a.z-btn { flex: 1 1 0; min-width: 0; justify-content: center; gap: 6px; height: 42px; padding: 0 8px; font-size: 13.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
  .s-mbar .s-mb-login { background: transparent; color: var(--brand-700); border: 1.5px solid var(--brand); }
  .s-mbar .s-mb-signup { background: linear-gradient(135deg, var(--brand-600), var(--brand-700)); color: #fff; border: 0; }
  .s-mbar .s-mb-a:not(.s-mb-login):not(.s-mb-signup) { background: var(--surface-2); color: var(--brand-700); border: 1px solid var(--border); }
  .s-mbar.on-dark { background: #10182f; border-bottom-color: rgba(255,255,255,.08); }
  .s-mbar.on-dark .s-mb-login { color: #fff; border-color: rgba(255,255,255,.55); }
  .s-mbar.on-dark .s-mb-signup { background: linear-gradient(135deg, #4a68b8, #223468); }
  .s-mbar.on-dark > .z-btn-secondary, .s-mbar.on-dark .s-mb-a:not(.s-mb-login):not(.s-mb-signup) { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #fff; }
}
@media (min-width: 761px) and (max-width: 1080px) {
  .s-mbar { justify-content: center; }
  .s-mbar > a.s-mb-a { display: none; }
  .s-mbar > .z-btn { flex: 0 0 auto; padding: 0 22px; }
}
@media (max-width: 360px) { .s-mbar > .z-btn, .s-mbar > a.z-btn { font-size: 12.5px; padding: 0 4px; } .s-mbar .z-ic { display: none; } }

/* ================= الطباعة: تقرير الزيارات + الفاتورة (A4) — 2026-10-12 ================= */
@page { size: A4; margin: 10mm 10mm 12mm; }
.z-rpt { font-family: var(--font); color: #111; font-size: 10.5px; line-height: 1.3; }
.z-rpt-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #223468; padding-bottom: 7px; margin-bottom: 8px; }
.z-rpt-id { display: flex; align-items: center; gap: 9px; }
.z-rpt-id img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.z-rpt-id h1 { font-size: 15px; margin: 0; color: #223468; }
.z-rpt-id .sub { color: #555; font-size: 10px; }
.z-rpt-title { text-align: left; }
.z-rpt-title b { font-size: 15px; color: #223468; display: block; }
.z-rpt-title div { color: #333; font-size: 10.5px; }
.z-rpt-sum { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 8px; }
.z-rpt-sum > div { border: 1px solid #cfd5e3; border-radius: 6px; padding: 4px 6px; text-align: center; background: #f6f8fc; }
.z-rpt-sum b { display: block; font-size: 15px; color: #223468; line-height: 1.2; }
.z-rpt-sum span { font-size: 9.5px; color: #444; }
.z-rpt-tbl { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.z-rpt-tbl thead { display: table-header-group; }
.z-rpt-tbl tr { break-inside: avoid; page-break-inside: avoid; }
.z-rpt-tbl th { background: #223468; color: #fff; text-align: start; padding: 3px 5px; border: 1px solid #223468; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.z-rpt-tbl td { padding: 2.4px 5px; border: 1px solid #dde2ee; vertical-align: middle; }
.z-rpt-tbl tbody tr:nth-child(even) td { background: #f8f9fc; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.z-rpt-tbl tr.day-start td { border-top: 1.6px solid #7f8bb0; }
.z-rpt-tbl .idx { width: 26px; text-align: center; }
.z-rpt-tbl .n { text-align: center; white-space: nowrap; width: 15%; }
.z-rpt-tbl .m { text-align: left; white-space: nowrap; }
.z-rpt-tbl td.st { font-weight: 700; white-space: nowrap; }
.z-rpt-tbl td.st-cancelled, .z-rpt-tbl td.st-no_show { color: #8a2f1f; }
.z-rpt-tbl td.st-attended { color: #0b6b47; }
.z-rpt-tbl tfoot td { font-weight: 800; background: #eef1f8; border-top: 2px solid #223468; }
.z-rpt-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.z-rpt-note { margin: 0 0 8px; padding: 5px 8px; background: #fff7e6; border: 1px solid #f0d9ae; border-radius: 6px; font-size: 10px; }
.z-rpt-empty { text-align: center; padding: 24px; color: #555; }
.z-rpt-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 5px; border-top: 1px solid #cfd5e3; font-size: 9.5px; color: #555; }
.z-rpt-tbl td.z-num, .z-rpt-tbl th.z-num { display: table-cell; } /* z-num عامة = inline-block وتكسر تخطيط الجدول */

/* ---------- الفاتورة المطبوعة (A4، صفحة واحدة) ---------- */
.z-inv { font-family: var(--font); color: #111; font-size: 12px; line-height: 1.5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.z-inv h1 { font-size: 18px; margin: 0 0 2px; color: #223468; }
.z-inv h3 { font-size: 12px; margin: 0 0 4px; color: #223468; border-bottom: 1px solid #cfd5e3; padding-bottom: 3px; }
.z-inv p { margin: 1px 0; }
.z-inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 10px; border-bottom: 3px solid #223468; margin-bottom: 12px; }
.z-inv-id { display: flex; gap: 11px; align-items: center; }
.z-inv-id img { width: 58px; height: 58px; border-radius: 12px; object-fit: cover; }
.z-inv-id div div { font-size: 11px; color: #444; }
.z-inv-title { text-align: left; min-width: 150px; }
.z-inv-title b { font-size: 22px; color: #223468; display: block; line-height: 1.2; }
.z-inv-title .no { font-size: 15px; font-weight: 800; }
.z-inv-stamp { display: inline-block; margin-top: 6px; padding: 2px 12px; border: 1.5px solid; border-radius: 99px; font-weight: 800; font-size: 11.5px; }
.z-inv-stamp.ok { color: #0b6b47; background: #e6f4ee; }
.z-inv-stamp.warn { color: #8f5e12; background: #fbf1e1; }
.z-inv-stamp.danger { color: #a3321f; background: #fbe9e6; }
.z-inv-stamp.gray { color: #4b5563; background: #eef0f4; }
.z-inv-info { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.z-inv-info > div { border: 1px solid #cfd5e3; border-radius: 8px; padding: 8px 11px; background: #f8f9fc; }
.z-inv-items { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.z-inv-items th { background: #223468; color: #fff; padding: 6px 8px; text-align: start; font-size: 12px; border: 1px solid #223468; }
.z-inv-items td { padding: 6px 8px; border: 1px solid #dde2ee; }
.z-inv-items tbody tr:nth-child(even) td { background: #f8f9fc; }
.z-inv-items .n { text-align: center; width: 48px; }
.z-inv-items .m { text-align: left; white-space: nowrap; width: 110px; }
.z-inv-bottom { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; break-inside: avoid; }
.z-inv-pays table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.z-inv-pays th { background: #eef1f8; padding: 4px 7px; text-align: start; border: 1px solid #cfd5e3; }
.z-inv-pays td { padding: 4px 7px; border: 1px solid #dde2ee; }
.z-inv-pays .m { text-align: left; white-space: nowrap; }
.z-inv-totals { border: 1.5px solid #223468; border-radius: 10px; overflow: hidden; }
.z-inv-totals > div { display: flex; justify-content: space-between; padding: 6px 12px; border-bottom: 1px solid #dde2ee; font-size: 12.5px; }
.z-inv-totals .grand { font-size: 15px; font-weight: 800; border-bottom: 0; padding: 8px 12px; }
.z-inv-totals .grand.due { background: #fbe9e6; color: #a3321f; }
.z-inv-totals .grand.clear { background: #e6f4ee; color: #0b6b47; }
.z-inv-void { margin: 12px 0 0; padding: 7px 12px; border: 1.5px dashed #a3321f; color: #a3321f; border-radius: 8px; font-weight: 700; text-align: center; }
.z-inv-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 8px; border-top: 1px solid #cfd5e3; font-size: 11px; color: #555; }
.z-inv td.z-num, .z-inv th.z-num { display: table-cell; }

/* ===== صورة الطبيب + الأفاتار بصورة ===== */
.z-avatar.xl { width: 84px; height: 84px; font-size: 28px; }
.z-avatar.has-img { background: var(--surface-2); overflow: hidden; }
.z-avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.z-photo-field { display: flex; gap: 14px; align-items: center; grid-column: 1 / -1; }

/* ===== السجل الطبي (z-med-*) ===== */
.z-med-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.z-med-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.z-med-card { text-align: start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; font: inherit; color: inherit; }
.z-med-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm, 0 2px 8px rgba(34,52,104,.08)); }
.z-med-cardtop { display: flex; justify-content: space-between; gap: 8px; }
.z-med-cardtxt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); line-height: 1.7; }
.z-med-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.z-med { display: flex; flex-direction: column; gap: 14px; }
.z-med-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.z-med-info small { display: block; color: var(--text-3); font-size: 12px; }
.z-med-sec { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); }
.z-med-sechead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.z-med-sechead h4 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.z-med-secbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.z-med-none { padding: 10px 2px; }
.z-med-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.z-med-file { position: relative; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 8px; background: var(--surface); }
.z-med-file.err { border-color: var(--danger); }
.z-med-fthumb { width: 72px; height: 72px; flex: none; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.z-med-fthumb img { width: 100%; height: 100%; object-fit: cover; }
.z-med-fmeta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.z-med-fmeta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-med-fmeta small { color: var(--text-3); }
.z-med-fnote { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-med-pdf { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--brand); }
.z-med-x { position: absolute; top: 6px; inset-inline-end: 6px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; padding: 0; }
.z-med-tlist { display: flex; flex-direction: column; gap: 10px; }
.z-med-t { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.z-med-thead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.z-med-source { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.z-med-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 14px; border: 2px dashed var(--border-strong, var(--border)); border-radius: 14px; background: var(--surface-2); cursor: pointer; font: inherit; color: var(--brand); }
.z-med-pick:hover { border-color: var(--brand); }
.z-med-pick span { color: var(--text-3); font-size: 13px; }
.z-med-cam, .z-med-editor { display: flex; flex-direction: column; gap: 12px; }
.z-med-video { position: relative; background: #0b1020; border-radius: 12px; overflow: hidden; display: grid; place-items: center; min-height: 220px; }
.z-med-video video { width: 100%; max-height: 58vh; display: block; }
.z-med-vload { position: absolute; color: #fff; }
.z-med-camrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.z-med-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.z-med-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; }
.z-med-thumb img { width: 100%; height: 100%; object-fit: cover; }
.z-med-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 6px; }
.z-med-stage { display: grid; place-items: center; background: #1b2236; border-radius: 12px; padding: 12px; }
.z-med-canvaswrap { position: relative; display: inline-block; line-height: 0; max-width: 100%; overflow: hidden; }
.z-med-canvaswrap canvas { max-width: 100%; max-height: 56vh; width: auto; height: auto; display: block; }
.z-med-ov { position: absolute; inset: 0; touch-action: none; }
.z-med-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); cursor: move; touch-action: none; }
.z-med-h { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; background: #fff; border: 2px solid var(--brand); border-radius: 50%; touch-action: none; }
.z-med-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.z-med-chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: 14px; }
.z-med-full { text-align: center; } .z-med-full img { max-width: 100%; max-height: 72vh; border-radius: 8px; }
.z-med-pdfview { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 720px) {
  .z-med-files { grid-template-columns: 1fr; }
  .z-med-sechead { align-items: stretch; flex-direction: column; }
  .z-med-secbtns .z-btn { flex: 1; justify-content: center; }
  .z-med-actions { justify-content: stretch; } .z-med-actions .z-btn { flex: 1; justify-content: center; }
}

.z-med-groups { display: flex; flex-direction: column; gap: 18px; }
.z-med-group { border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--surface-2); }
.z-med-grouphead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.z-med-grouphead > div { flex: 1; }

.z-med-docchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.z-med-docchip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.z-med-docchip.on { border-color: var(--brand); background: var(--surface-2); font-weight: 700; }

/* ===== خريطة الموقع والنجوم (الخدمات المنزلية والتقييمات) ===== */
.zm-wrap { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.zm-wrap.invalid { border-color: var(--danger); }
.zm-bar { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.zm-btn { border: 1px solid var(--brand); background: var(--surface); color: var(--brand); border-radius: 99px; padding: 6px 14px; font-weight: 700; cursor: pointer; min-height: 36px; }
.zm-btn:hover { background: var(--brand-50); }
.zm-hint { color: var(--text-2); font-size: 13px; }
.zm-map { width: 100%; background: #e9edf5; z-index: 0; }
.zm-pin { background: none; border: 0; }
.zm-foot { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; font-size: 12.5px; color: var(--text-2); border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.zm-fail { padding: 18px; text-align: center; color: var(--text-2); background: var(--surface-2); font-size: 14px; }
.zm-wrap .leaflet-container { font-family: var(--font); }
.zs { display: inline-flex; gap: 2px; vertical-align: middle; direction: ltr; }
.zs-star { display: block; }
.zs-input { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.zs-input .zs-btn { background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 8px; line-height: 0; }
.zs-input .zs-btn:focus-visible { outline: 2px solid var(--brand); }
.zs-input .zs-word { margin-inline-start: 8px; color: var(--text-2); font-weight: 700; font-size: 14px; }

/* ===== الحالات المنزلية ===== */
.z-hm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.z-hm-kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.z-hm-kv dt { color: var(--text-2); }
.z-hm-kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.z-hm-areas { display: flex; gap: 6px; flex-wrap: wrap; }
.z-hm-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--brand-50); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-size: 12.5px; font-weight: 700; }
.z-hm-flow { display: flex; gap: 8px; flex-wrap: wrap; }
.z-hm-svc { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.z-hm-svc:last-child { border-bottom: 0; }
.z-hm-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.z-rt-card { padding: 14px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.z-rt-card:last-child { border-bottom: 0; }
.z-rt-card.hidden { background: var(--surface-2); }
.z-rt-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.z-rt-avg { display: flex; align-items: center; gap: 10px; }
.z-rt-avg b { font-size: 26px; line-height: 1; }
@media (max-width: 720px) {
  .z-hm-grid { grid-template-columns: 1fr; }
  .z-hm-kv { grid-template-columns: 90px 1fr; }
  .z-hm-svc { grid-template-columns: 40px 1fr; }
  .z-hm-svc .z-actions { grid-column: 1 / -1; }
}
.zm-search { display: flex; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface); }
.zm-search input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 12px; background: var(--surface); }
.zm-search input:focus { outline: 2px solid var(--brand); outline-offset: 0; }
.zm-res { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; border-bottom: 1px solid var(--border); background: var(--surface); }
.zm-res li + li { border-top: 1px solid var(--border); }
.zm-res button { display: block; width: 100%; text-align: start; padding: 9px 12px; background: none; border: 0; cursor: pointer; font-size: 13.5px; }
.zm-res button:hover { background: var(--brand-50); }

/* ===== الإسعاف (ambulance.jsx) ===== */
.z-amb-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.z-amb-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border: 1.5px solid var(--border); }
.z-amb-card.is-new { border-color: #e7b3a9; background: linear-gradient(180deg, #fff7f5, var(--surface) 60%); }
.z-amb-card.is-sel { box-shadow: 0 0 0 3px rgba(34, 52, 104, .25); }
.z-amb-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.z-amb-body { display: grid; gap: 6px; font-size: 14px; color: var(--text-2); }
.z-amb-body b { color: var(--text); }
.z-amb-body .z-icon, .z-amb-body svg { vertical-align: -2px; }
.z-amb-notes { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; }
.z-amb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.z-amb-actions a.z-btn { text-decoration: none; }
.z-amb-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 16px; font-size: 13px; color: var(--text-2); }
.z-amb-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 99px; margin-inline-end: 6px; vertical-align: -1px; }
.z-amb-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.z-amb-dl small { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 2px; }
@media (max-width: 720px) { .z-amb-list { grid-template-columns: 1fr; } .z-amb-dl { grid-template-columns: 1fr; } }

/* رقم الكشف (تسلسل مستقل لكل طبيب) */
.z-visit { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; background: rgba(34, 52, 104, .09); color: var(--brand); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.z-tg-no { font-weight: 800; color: var(--brand); background: rgba(255, 255, 255, .7); border-radius: 6px; padding: 0 5px; font-size: 11.5px; white-space: nowrap; }
.z-tl-info strong .z-visit { margin-inline-end: 6px; }
/* رقم الكشف أوضح: شارة كحلية مصمتة بنص أبيض */
.z-visit { background: var(--brand); color: #fff; padding: 2px 11px; font-size: 14px; box-shadow: 0 1px 2px rgba(34, 52, 104, .25); }
.z-visit .z-num { font-size: 15px; }
.z-tg-no { background: var(--brand); color: #fff; padding: 0 6px; border-radius: 6px; }
.z-tl-info strong .z-visit { font-size: 13.5px; }
/* لون مميز لرقم الكشف (برتقالي — تباين أبيض/برتقالي ≥ 5:1) */
.z-visit, .z-tg-no { background: #c2410c; color: #fff; }
.z-visit { box-shadow: 0 1px 3px rgba(194, 65, 12, .35); }
/* يمنع قواعد النص الرمادي في البطاقات (مثل .z-tl-info span) من تغميق نص الشارة */
.z-visit, .z-visit .z-num, .z-tl-info .z-visit, .z-tl-info .z-visit .z-num, .z-tg-no, .z-tg-no .z-num { color: #fff; opacity: 1; }
.z-tl-info .z-visit { font-size: 14px; font-weight: 800; overflow: visible; text-overflow: clip; }

/* مدة استقبال الحجز الأونلاين (إعدادات) */
.z-ow { display: grid; gap: 8px; margin-top: 12px; max-width: 560px; }
.z-ow-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.z-ow-row.is-off { background: var(--surface-2); }
.z-ow-day { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.z-ow-row label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }

/* وقت استقبال الحجز الأونلاين داخل بطاقة اليوم (مواعيد الطبيب) */
.z-wh-ow { flex-basis: 100%; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 8px; margin-top: 2px; border-top: 1px dashed var(--border); }
.z-wh-ow label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.z-wh-ow .z-input { width: 118px; height: 36px; }
