/* بوابة مطمئن — ألوان الهوية: كحلي #1B2A4A وفيروزي #27B8CC */
[hidden] { display: none !important; }

:root {
  --navy: #14213d;
  --navy-2: #1b2a4a;
  --brand: #27b8cc;
  --teal: #0b8a9c;
  --teal-strong: #087a8a;
  --teal-soft: #e2f6f8;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #16223b;
  --muted: #5f6c84;
  --border: #e3e8f0;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 14px rgba(16, 24, 40, 0.06);
  --ok: #137a48;
  --ok-bg: #e3f5ea;
  --warn: #965a00;
  --warn-bg: #fff2d9;
  --danger: #b42318;
  --danger-bg: #fdeceb;
  --info: #1d5fd0;
  --info-bg: #e8f0fe;
  --violet: #6a3fc8;
  --violet-bg: #f0eafd;
  --muted-bg: #edf0f5;
  --radius: 14px;
  --sidebar: 256px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --navy: #0b1424;
    --navy-2: #0f1b30;
    --teal: #3cc4d6;
    --teal-strong: #2fb3c5;
    --teal-soft: #11313a;
    --bg: #0d1522;
    --surface: #152033;
    --surface-2: #1a273d;
    --text: #e7ecf4;
    --muted: #9aa8bd;
    --border: #263449;
    --shadow-sm: none;
    --shadow: none;
    --ok: #5fd39a;
    --ok-bg: #11342a;
    --warn: #f5be5b;
    --warn-bg: #3a2c12;
    --danger: #ff8a80;
    --danger-bg: #3d1a1a;
    --info: #8ab4ff;
    --info-bg: #1a2a4a;
    --violet: #b9a0ff;
    --violet-bg: #2a2147;
    --muted-bg: #223047;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --navy: #0b1424;
  --navy-2: #0f1b30;
  --teal: #3cc4d6;
  --teal-strong: #2fb3c5;
  --teal-soft: #11313a;
  --bg: #0d1522;
  --surface: #152033;
  --surface-2: #1a273d;
  --text: #e7ecf4;
  --muted: #9aa8bd;
  --border: #263449;
  --shadow-sm: none;
  --shadow: none;
  --ok: #5fd39a;
  --ok-bg: #11342a;
  --warn: #f5be5b;
  --warn-bg: #3a2c12;
  --danger: #ff8a80;
  --danger-bg: #3d1a1a;
  --info: #8ab4ff;
  --info-bg: #1a2a4a;
  --violet: #b9a0ff;
  --violet-bg: #2a2147;
  --muted-bg: #223047;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
i svg, .icon-btn svg { width: 20px; height: 20px; display: block; }
i { display: inline-flex; font-style: normal; flex-shrink: 0; }
h1, h2, h3, h4 { line-height: 1.35; }
.sub { color: var(--muted); margin: 2px 0 0; }
.muted { color: var(--muted); }
.pad { padding: 8px 2px; margin: 0; }
.spacer { flex: 1; }
.plain { margin: 0; padding-inline-start: 18px; }
.loading { padding: 64px 16px; text-align: center; color: var(--muted); display: flex; gap: 10px; justify-content: center; align-items: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--teal); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page.enter { animation: rise 0.22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page.enter, .spinner { animation: none; } }
.credit { font-size: 11px; color: var(--muted); opacity: 0.85; margin: 0; text-align: center; }

/* ---------- الأزرار والحقول ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 16px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: #cfd7e3; }
.btn:active { transform: translateY(1px); }
.btn i svg { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(180deg, #13a2b5, var(--teal-strong)); border-color: var(--teal-strong); color: #fff; box-shadow: 0 2px 8px rgba(11, 138, 156, 0.25); }
.btn-primary:hover { background: var(--teal-strong); border-color: var(--teal-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-soft { background: var(--teal-soft); border-color: transparent; color: var(--teal); }
.btn-soft:hover { background: var(--teal-soft); filter: brightness(0.97); }
.btn-done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.btn-out { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn-out:hover { background: var(--navy); }
.btn-wa { background: #1fae5b; border-color: #1fae5b; color: #fff; }
.btn-wa:hover { background: #179a4f; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal); }
.btn-lg { padding: 12px 20px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.icon-btn {
  border: 0; background: transparent; padding: 8px; border-radius: 9px; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; font-size: 18px; font-weight: 600;
}
.icon-btn:hover { background: var(--muted-bg); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-bg); color: var(--danger); }
.link { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 8px; text-decoration: underline; }
.link-sm { font-size: 13px; font-weight: 500; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); min-height: 42px; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
input[readonly], select:disabled, textarea[readonly] { background: var(--surface-2); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field > span { font-weight: 500; }
.req { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.input-btn { display: flex; gap: 6px; }
.input-btn input { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; min-height: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; transition: all 0.15s; }
.chip input:checked + span { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  font-weight: 600; font-size: 13px; letter-spacing: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.hue-0 { background: #dff3f6; color: #0b7584; }
.hue-1 { background: #e6edfd; color: #2753b8; }
.hue-2 { background: #efe8fc; color: #6a3fc8; }
.hue-3 { background: #fdeee0; color: #a75413; }
.hue-4 { background: #e2f4e9; color: #1d7a47; }
.hue-5 { background: #fce7ef; color: #b02a5b; }
.name-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- تسجيل الدخول ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-brand {
  background: radial-gradient(circle at 20% 15%, rgba(39, 184, 204, 0.35), transparent 45%), linear-gradient(160deg, #1b2a4a 0%, #14213d 55%, #0d4e5c 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px;
}
.brand-inner { max-width: 420px; }
.logo-chip { background: #fff; border-radius: 14px; padding: 8px 12px; display: inline-flex; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); }
.logo-chip .logo { height: 46px; display: block; }
.auth-brand h1 { font-size: 34px; margin: 26px 0 6px; }
.auth-brand p { color: #c9d6ea; margin: 0 0 26px; font-size: 17px; }
.brand-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.brand-points li { display: flex; gap: 10px; align-items: center; color: #e4ecf8; }
.brand-points i { background: rgba(39, 184, 204, 0.25); color: #7fe3f0; border-radius: 50%; padding: 4px; }
.brand-points i svg { width: 16px; height: 16px; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px 20px 20px; gap: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 26px; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.auth-form input { min-height: 48px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }
.mobile-logo { display: none; }
.form-msg { margin: 0; color: var(--danger); font-size: 14px; }
.form-msg:empty { display: none; }
.demo-note { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 11px; font-size: 14px; margin: 14px 0; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.role-card {
  display: flex; align-items: center; gap: 10px; padding: 12px; text-align: start;
  border: 1px solid var(--border); border-radius: 13px; background: var(--surface); cursor: pointer; transition: all 0.15s;
}
.role-card:hover { border-color: var(--teal); background: var(--teal-soft); transform: translateY(-1px); }
.role-card div { display: flex; flex-direction: column; min-width: 0; }
.role-card strong { color: var(--text); font-size: 14px; }
.role-card span { color: var(--muted); font-size: 12.5px; }
.row { display: flex; gap: 10px; margin-top: 18px; }

/* ---------- الهيكل ---------- */
.demo-bar { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 12.5px; padding: 4px; font-weight: 500; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: #d6deeb;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.brand .logo-chip { padding: 6px 10px; border-radius: 12px; box-shadow: none; }
.brand .logo { height: 40px; }
.app-name { font-weight: 600; color: #fff; font-size: 15px; padding-inline-start: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px;
  color: #cfd8e7; text-decoration: none !important; font-weight: 500; transition: background 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active { background: var(--brand); color: #08202a; box-shadow: 0 4px 14px rgba(39, 184, 204, 0.3); }
.nav-label { font-size: 11.5px; color: #8494b0; padding: 14px 12px 4px; font-weight: 600; letter-spacing: 0.2px; }
.me { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px; margin: 0 10px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.me > .me-tools { flex: 1 1 100%; flex-direction: row; justify-content: space-between; }
.me > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.me strong { font-size: 13.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: #8b99b3; font-size: 12px; }
.me .icon-btn { color: #b6c2d6; min-width: 32px; min-height: 32px; padding: 6px; }
.me .icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar .credit { color: #7d8ca6; padding: 0 12px 12px; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.bottom-nav { display: none; }
.content { padding: 28px 32px 32px; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; flex: 1; }
.page-credit { padding: 8px 16px 20px; }
.scrim { display: none; }

/* ---------- الصفحات ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .title { display: flex; align-items: center; gap: 14px; }
.title-icon { background: var(--teal-soft); color: var(--teal); padding: 10px; border-radius: 13px; }
.title-icon svg { width: 22px; height: 22px; }
.count { color: var(--muted); font-weight: 400; font-size: 0.7em; }
.section-title { font-size: 17px; margin: 22px 0 10px; }
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--muted-bg); padding: 4px; border-radius: 13px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 500; }
.tab small { opacity: 0.7; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.search { position: relative; display: block; width: 280px; max-width: 100%; }
.search i { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search i svg { width: 18px; height: 18px; }
.search input { padding-inline-start: 38px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
.table-wrap.flat { box-shadow: none; border: 0; border-radius: 0; margin: 0 -20px -18px; border-top: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; }
table.data th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { cursor: pointer; transition: background 0.12s; }
table.data tbody tr.no-click { cursor: default; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .actions { width: 48px; text-align: end; white-space: nowrap; }
table.data .row-actions { width: 96px; }
table.data select { min-width: 160px; min-height: 36px; padding: 5px 10px; }
.ref-link { font-weight: 500; }
.empty { padding: 44px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty > i { background: var(--muted-bg); padding: 14px; border-radius: 16px; }
.empty > i svg { width: 26px; height: 26px; }
.empty p { margin: 0; }
.empty.error { color: var(--danger); }

/* ---------- بطاقات ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 16.5px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 i { color: var(--teal); }
.card h2 i svg { width: 19px; height: 19px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  --c: var(--teal); --cb: var(--teal-soft);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  text-decoration: none !important; color: inherit; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform 0.15s, border-color 0.15s;
}
.stat::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--c); }
.stat:hover { border-color: var(--c); transform: translateY(-2px); }
.stat i { grid-row: 1 / 3; background: var(--cb); color: var(--c); padding: 10px; border-radius: 12px; }
.stat strong { font-size: 26px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13.5px; }
.tone-blue { --c: var(--info); --cb: var(--info-bg); }
.tone-green { --c: var(--ok); --cb: var(--ok-bg); }
.tone-amber { --c: var(--warn); --cb: var(--warn-bg); }
.tone-red { --c: var(--danger); --cb: var(--danger-bg); }
.tone-violet { --c: var(--violet); --cb: var(--violet-bg); }
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
.timeline, .alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.timeline li { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 11px; background: var(--surface-2); }
.timeline li > div { display: flex; flex-direction: column; min-width: 0; }
.timeline li a { color: var(--text); font-weight: 500; }
.timeline b { font-variant-numeric: tabular-nums; color: var(--teal); }
.timeline small { color: var(--muted); }
.alerts li { padding: 9px 12px; border-radius: 10px; border-inline-start: 3px solid; font-size: 14px; }
.alerts li a { color: inherit; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-ok, .alert-info { background: var(--info-bg); color: var(--info); }
.related-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.related-head h2 { margin: 0; }

/* حضوري اليوم */
.attend { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; background: linear-gradient(90deg, var(--teal-soft), var(--surface) 70%); }
.attend-info { display: flex; align-items: center; gap: 12px; }
.attend-info > div { display: flex; flex-direction: column; }
.attend-info small { color: var(--muted); }
.done-pill { display: inline-flex; gap: 6px; align-items: center; background: var(--ok-bg); color: var(--ok); padding: 8px 14px; border-radius: 999px; font-weight: 600; }

/* ---------- الملف الشامل ---------- */
.record-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.record-head .back { color: var(--muted); padding: 6px; border-radius: 9px; transform: scaleX(-1); }
.record-head .back:hover { background: var(--muted-bg); }
.record-title { flex: 1; min-width: 200px; }
.record-title h1 { margin: 0; font-size: 22px; }
.diagnosis { margin: 6px 0 0; background: var(--surface-2); border-radius: 9px; padding: 6px 10px; display: inline-block; font-size: 14px; }
.record-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.quick { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--teal); background: var(--teal-soft); color: var(--teal); padding: 8px 14px; border-radius: 11px; cursor: pointer; font-weight: 600; }
.quick:hover { border-style: solid; }
.quick i svg { width: 18px; height: 18px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 20px; margin-bottom: 14px; }
.info-grid small { color: var(--muted); font-size: 12.5px; }
.related-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.related { overflow: hidden; }

/* ---------- واجهة التمريض ---------- */
.visit-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.visit-card { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); border-inline-start: 5px solid var(--brand); }
.visit-card.done { border-inline-start-color: var(--ok); opacity: 0.85; }
.vc-time { font-size: 20px; font-weight: 700; color: var(--teal); font-variant-numeric: tabular-nums; min-width: 58px; }
.visit-card.done .vc-time { color: var(--ok); }
.vc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.vc-patient { display: flex; align-items: center; gap: 10px; }
.vc-patient > div { display: flex; flex-direction: column; min-width: 0; }
.vc-patient a { font-weight: 600; font-size: 16px; color: var(--text); }
.vc-patient small { color: var(--muted); }
.vc-dx { margin: 0; font-size: 13.5px; color: var(--muted); background: var(--surface-2); padding: 6px 10px; border-radius: 9px; }
.vc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vc-actions .btn { flex: 1; min-width: 92px; }

.modal-lg { max-width: 760px; }
.visit-form { display: flex; flex-direction: column; gap: 14px; }
.vf-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; background: var(--surface-2); padding: 12px 14px; border-radius: 12px; }
.vf-head > div:first-child { display: flex; flex-direction: column; }
.vf-head strong { font-size: 17px; }
.vf-head small { color: var(--muted); }
.vf-meta { display: flex; gap: 8px; }
.vf-date { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 4px; }
.vf-date input, .vf-date select { min-height: 38px; padding: 6px 10px; }
.vf-section h4 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.vf-section h4 i { color: var(--teal); }
.vf-section h4 i svg { width: 18px; height: 18px; }
.vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.vital { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); padding: 8px 10px; border-radius: 12px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.vital input { font-size: 18px; font-weight: 600; text-align: center; min-height: 44px; }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.check-item:has(input:checked) { background: var(--ok-bg); border-color: var(--ok); }
.check-item input { width: 22px; height: 22px; min-height: 0; accent-color: var(--ok); flex-shrink: 0; }
.check-item span { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.check-item small { color: var(--muted); width: 100%; }
.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { flex: 1; min-width: 110px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; color: var(--muted); }
.seg.active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-strong); box-shadow: inset 0 0 0 1px var(--teal); }
.seg-ok.active { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.seg-warn.active { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.seg-danger.active { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.supplies { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.supply-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--surface-2); border-radius: 10px; }
.supply-row > span { flex: 1; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper b { min-width: 24px; text-align: center; }

/* بيانات الدخول */
.creds p { margin: 0 0 12px; }
.creds-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.creds-box > div { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.creds-box small { color: var(--muted); }
.creds-box strong { font-size: 18px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- النوافذ والإشعارات ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(10, 18, 32, 0.55); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade 0.15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 680px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body > p { margin: 0; }
.modal-foot { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
#toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { padding: 11px 18px; border-radius: 12px; background: var(--navy-2); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: opacity 0.3s; font-weight: 500; }
.toast-danger { background: var(--danger); }
.toast.hide { opacity: 0; }

/* ---------- الشاشات المتوسطة ---------- */
@media (max-width: 1000px) {
  .dash-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .mobile-logo { display: flex; justify-content: center; margin-bottom: 18px; }
  .mobile-logo .logo { height: 52px; }
  .auth-card { text-align: center; }
  .auth-form { text-align: start; }
}

/* ---------- الجوال ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; transform: translateX(100%); transition: transform 0.22s; }
  [dir='ltr'] .sidebar { transform: translateX(-100%); }
  [dir='ltr'] .nav-open .sidebar { transform: none; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar .logo { height: 32px; border-radius: 6px; background: #fff; padding: 2px 6px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 25; background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; box-shadow: 0 -4px 16px rgba(16, 24, 40, 0.06);
  }
  .bottom-nav .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11.5px; color: var(--muted); flex: 1; border: 0; background: none; cursor: pointer; border-radius: 10px; }
  .bottom-nav .nav-item.active { background: var(--teal-soft); color: var(--teal); box-shadow: none; }
  .bottom-nav .nav-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .content { padding: 16px 14px 24px; }
  .page-credit { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 20px; }
  .page-head .btn-primary { width: 100%; }
  .search { width: 100%; }
  .tabs { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat i { display: none; }
  .stat strong, .stat span { grid-column: 1 / -1; }
  .visit-cards { grid-template-columns: 1fr; }
  .visit-card { flex-direction: column; gap: 6px; }
  .attend .btn { width: 100%; }
  .record-actions { width: 100%; }
  .record-actions .btn { flex: 1; }
  .creds-box { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; place-items: end stretch; }
  .modal { max-height: 94vh; border-radius: 18px 18px 0 0; max-width: none; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .spacer { display: none; }
  .table-wrap.flat { margin: 0 -20px -18px; }

  /* الجداول تتحول إلى بطاقات */
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-wrap.flat { border-top: 0; padding: 0 12px 12px; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 4px; position: relative; box-shadow: var(--shadow-sm); }
  table.data td { border: 0; padding: 5px 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: end; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: start; flex-shrink: 0; }
  table.data td:first-child { font-weight: 600; padding-inline-end: 52px; }
  table.data td.actions { position: absolute; top: 4px; inset-inline-end: 4px; width: auto; padding: 0; }
  table.data td.actions::before { content: none; }
  table.data .row-actions { width: auto; }
  table.data tr:has(.row-actions) td:first-child { padding-inline-end: 92px; }
  table.data select { min-width: 0; width: auto; max-width: 60%; }
}
@media (max-width: 760px) {
  .vc-actions .btn-primary, .vc-actions .btn-done { flex-basis: 100%; }
}

/* =================== التقويم والجدولة =================== */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px var(--surface); }
.en-name { display: block; font-size: 15px; font-weight: 500; color: #9fdbe6; letter-spacing: 1px; margin-top: 2px; }
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.date-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-nav strong { min-width: 130px; text-align: center; font-size: 16px; }
.date-pick { width: auto; min-height: 36px; padding: 4px 8px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; font-size: 13.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-travel, .legend-transfer { width: 22px; height: 12px; border-radius: 4px; display: inline-block; }
.legend-travel { background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.35) 0 4px, rgba(100, 116, 139, 0.12) 4px 8px); }
.legend-transfer { border: 2px dashed var(--muted); }

.cal-scroll { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: 72vh; }
.cal-grid { display: grid; grid-template-columns: 54px repeat(var(--cols), minmax(170px, 1fr)); min-width: min-content; }
.cal-grid.week { grid-template-columns: 54px repeat(7, minmax(120px, 1fr)); }
.cal-head {
  position: sticky; top: 0; z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border);
  padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; min-height: 58px; border-top: 3px solid var(--c, transparent);
}
.cal-head strong { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.cal-head small { font-size: 12px; color: var(--muted); }
.cal-corner { border-inline-start: 0; inset-inline-start: 0; z-index: 4; }
.day-head { font: inherit; text-align: start; cursor: pointer; color: inherit; border-inline-end: 0; border-bottom: 1px solid var(--border); }
.day-head:hover { background: var(--teal-soft); }
.day-head.is-today { border-top-color: var(--brand); background: var(--teal-soft); }
.cal-axis { position: relative; border-inline-end: 1px solid var(--border); }
.cal-axis span { position: absolute; inset-inline: 0; transform: translateY(-50%); text-align: center; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-axis span:first-child { transform: none; }
.cal-col {
  position: relative; border-inline-start: 1px solid var(--border); cursor: copy;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--border) 45%, transparent) 1px, transparent 1px); background-size: 100% 69px, 100% 34.5px; }
.ev {
  position: absolute; padding: 0; border: 0; border-radius: 9px; overflow: hidden; cursor: pointer; text-align: start; font: inherit;
  display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); transition: transform 0.1s, box-shadow 0.1s; z-index: 1;
}
.ev:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18); z-index: 2; }
.ev-travel {
  flex-shrink: 0; display: flex; align-items: flex-end; padding: 0 7px 2px; font-size: 11px; font-weight: 600;
  color: color-mix(in srgb, var(--c) 70%, #000); 
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 32%, transparent) 0 5px, color-mix(in srgb, var(--c) 14%, transparent) 5px 10px);
  border-inline-start: 3px solid var(--c);
}
.ev-visit { flex: 1; background: var(--c); color: #fff; padding: 3px 7px; display: flex; flex-direction: column; gap: 0; min-height: 18px; overflow: hidden; }
.ev-visit b { font-size: 11px; font-variant-numeric: tabular-nums; opacity: 0.95; }
.ev-title { font-size: 12.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-visit small { font-size: 11px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-transfer .ev-visit { background: var(--surface); color: var(--text); border: 2px dashed var(--c); border-top: 0; }
.ev-transfer .ev-visit b { color: var(--c); }
.ev.done .ev-visit { opacity: 0.55; }
.ev.conflict { outline: 2px solid var(--danger); outline-offset: 1px; }
.now-line { position: absolute; inset-inline: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.now-line::before { content: ''; position: absolute; inset-inline-start: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.agenda { margin-top: 14px; }
.agenda ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agenda li { display: grid; grid-template-columns: 58px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-inline-start: 4px solid var(--c); cursor: pointer; }
.ag-time { display: flex; flex-direction: column; align-items: center; }
.ag-time b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.ag-time small { font-size: 11px; color: var(--muted); }
.ag-body { display: flex; flex-direction: column; min-width: 0; }
.ag-body small { color: var(--muted); }
.ag-body a { display: inline-flex; gap: 4px; align-items: center; font-size: 13px; }
.ag-body a svg { width: 14px; height: 14px; }

/* نموذج الموعد: حساب الوقت */
.timing-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.timing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.mini-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 12px; cursor: pointer; color: var(--muted); }
.mini-chip:hover { border-color: var(--teal); color: var(--teal); }
.timing-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.ts-travel { display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 9px; background: repeating-linear-gradient(135deg, var(--muted-bg) 0 5px, var(--surface) 5px 10px); border: 1px solid var(--border); }
.ts-travel svg { width: 16px; height: 16px; }
.ts-visit { padding: 5px 10px; border-radius: 9px; background: var(--teal); color: #fff; }
.ts-arrow { color: var(--muted); }
.ts-conflict { width: 100%; display: flex; gap: 6px; align-items: center; color: var(--danger); background: var(--danger-bg); padding: 7px 10px; border-radius: 9px; font-weight: 500; font-size: 14px; }
.ts-conflict svg { width: 16px; height: 16px; }
.timing-hint { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.timing-hint:empty { display: none; }
.link-btn { background: none; border: 0; color: var(--teal); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; }
.danger-text { color: var(--danger) !important; }

/* =================== المرافقات =================== */
.ar-sub { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.cg-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.cg-check { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; background: var(--surface); transition: all 0.15s; }
.cg-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; min-height: 0; }
.cg-box { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; flex-shrink: 0; transition: all 0.15s; }
.cg-box svg { width: 18px; height: 18px; }
.cg-label { display: flex; flex-direction: column; line-height: 1.35; }
.cg-label small { color: var(--muted); }
.cg-check:has(input:checked) { background: var(--ok-bg); border-color: var(--ok); }
.cg-check:has(input:checked) .cg-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.cg-check:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }
.cg-editor { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.cg-editor .seg { display: flex; flex-direction: column; align-items: center; gap: 0; }
.cg-editor .seg small { font-weight: 400; font-size: 12px; }
.cg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cg-card { text-align: start; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--muted-bg); transition: transform 0.12s; }
.cg-card:hover { transform: translateY(-2px); }
.cg-card.tone-ok { border-top-color: var(--ok); }
.cg-card.tone-warn { border-top-color: var(--warn); }
.cg-card.tone-danger { border-top-color: var(--danger); }
.cg-card-head { display: flex; gap: 10px; align-items: center; }
.cg-card-head > div { display: flex; flex-direction: column; min-width: 0; }
.cg-card-head small { color: var(--muted); }
.cg-card-body { display: flex; flex-direction: column; gap: 6px; }
.progress { height: 7px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-between small { color: var(--muted); }
.cg-incident { margin: 0; display: flex; gap: 6px; align-items: flex-start; background: var(--warn-bg); color: var(--warn); padding: 6px 9px; border-radius: 9px; font-size: 13.5px; }
.cg-incident svg { width: 16px; height: 16px; margin-top: 2px; }

/* دخول نسخة التجربة */
.role-groups { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; max-height: 56vh; overflow-y: auto; padding-inline-end: 4px; text-align: start; }
.group-title { font-size: 14px; margin: 8px 0 6px; color: var(--muted); }
.group-title small { font-weight: 400; }
.auth-card > input[type='search'] { margin-top: 4px; }

@media (max-width: 760px) {
  .timing-grid { grid-template-columns: 1fr 1fr; }
  .cal-scroll { max-height: none; }
  .cal-grid { grid-template-columns: 44px repeat(var(--cols), minmax(150px, 1fr)); }
  .cal-grid.week { grid-template-columns: 44px repeat(7, minmax(110px, 1fr)); }
  .agenda li { grid-template-columns: 52px 1fr; }
  .agenda li > .name-cell, .agenda li > .badge { grid-column: 2; }
  .cg-checks { grid-template-columns: 1fr; }
  .role-groups { max-height: none; }
}
.tnum { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }

/* =================== الوصول وإتمام الزيارة والدفع =================== */
.btn-arrive { background: var(--info-bg); border-color: transparent; color: var(--info); font-weight: 600; }
.btn-arrive:hover { background: var(--info-bg); filter: brightness(0.96); }
.btn-complete { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn-complete:hover { background: var(--ok); filter: brightness(1.08); }
.pill-ok { display: inline-flex; align-items: center; gap: 5px; background: var(--info-bg); color: var(--info); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill-ok svg { width: 15px; height: 15px; }
.vc-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vc-status:empty { display: none; }
.vc-status .btn { flex: 1; min-width: 120px; }
.visit-card.needs-doc { border-inline-start-color: var(--warn); opacity: 1; }
.visit-card.needs-doc .vc-time { color: var(--warn); }
.pay-form { display: flex; flex-direction: column; gap: 16px; }
.amount-row { display: flex; align-items: center; gap: 8px; }
.amount-row input { font-size: 22px; font-weight: 700; text-align: center; min-height: 52px; }
.amount-row b { color: var(--muted); }
.seg-pay.active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); }
.seg-none.active { background: var(--muted-bg); border-color: var(--muted); color: var(--text); }
.remind { display: flex; gap: 14px; align-items: flex-start; }
.remind > i { background: var(--warn-bg); color: var(--warn); padding: 12px; border-radius: 14px; }
.remind > i svg { width: 26px; height: 26px; }
.remind p { margin: 0; line-height: 1.8; }
.remind-card { border-inline-start: 5px solid var(--warn); margin-bottom: 16px; background: linear-gradient(90deg, var(--warn-bg), var(--surface) 60%); }
.remind-card h2 { color: var(--warn); }
.remind-card h2 i { color: var(--warn); }
.remind-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.remind-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); padding: 8px 12px; border-radius: 11px; border: 1px solid var(--border); }
.remind-list li > div { display: flex; flex-direction: column; }
.remind-list small { color: var(--muted); }
.appt-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.appt-strip:empty, .appt-strip:not(:has(*)) { display: none; }
.agenda li .ag-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; }
.agenda li .ag-actions:empty { display: none; }
.agenda li .ag-actions .btn { padding: 7px 14px; }
.origin-seg .seg { min-width: 0; padding: 8px 6px; font-size: 13.5px; }
.timing-grid { grid-template-columns: repeat(2, 1fr); }

/* =================== سجل المرضى والاستيراد =================== */
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.file-no { font-variant-numeric: tabular-nums; color: var(--teal); }
.file-tag { display: inline-block; background: var(--teal-soft); color: var(--teal); font-weight: 700; padding: 2px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.file-tag small { font-weight: 400; color: var(--muted); }
.review-box { border-inline-start: 5px solid var(--warn); margin-bottom: 14px; }
.review-box h2 { color: var(--warn); }
.review-box ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.review-box details { margin-top: 8px; color: var(--muted); font-size: 14px; }
.review-box summary { cursor: pointer; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-box { display: flex; flex-direction: column; gap: 14px; }
.import-box > p { margin: 0; line-height: 1.8; }
.import-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.import-stats > div { background: var(--surface-2); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.import-stats strong { font-size: 22px; color: var(--teal); }
.import-stats span { color: var(--muted); font-size: 13px; }
.check-inline { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-inline input { width: 20px; height: 20px; min-height: 0; }
.more-btn { margin-top: 10px; }
.cal-head.lane-special { background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); }
@media (max-width: 760px) {
  .import-stats { grid-template-columns: 1fr 1fr; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
}
/* عرض أعمدة التقويم: أعمدة السيارات أعرض، والتكسي/الشخصي أضيق */
.cal-grid { --axis-w: 54px; --col-w: 170px; --col-w-sm: 104px; }
.lane-special strong { font-size: 12.5px; }
.lane-special .ev-title { font-size: 11.5px; }
@media (max-width: 760px) { .cal-grid { --axis-w: 44px; --col-w: 150px; --col-w-sm: 92px; } }

/* ---------- الحجز: بيانات المريض، الصق من واتساب ---------- */
.pt-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 8px; padding: 10px 12px; background: var(--teal-soft); border-radius: 12px; font-size: 14px; }
.pt-card[hidden] { display: none; }
.pt-edit { margin-top: 8px; }
.pt-edit summary { cursor: pointer; color: var(--teal-strong); font-weight: 600; font-size: 14px; padding: 4px 0; }
.pt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-top: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.pt-grid .wide { grid-column: 1 / -1; }
.inline-pair { display: flex; gap: 8px; }
.inline-pair input { flex: 1; min-width: 0; }
.inline-pair select { width: auto; }
.field-warn { color: var(--warn); font-size: 12px; }
.field-hint { color: var(--muted); font-size: 12px; }
.booked-by { font-size: 13px; margin: 0; }
.paste-area { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); resize: vertical; }
.paste-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.paste-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.paste-card.done { opacity: 0.6; background: var(--ok-bg); }
.pc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-main small { color: var(--muted); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) {
  .pt-grid { grid-template-columns: 1fr; }
  .paste-card { flex-direction: column; align-items: stretch; }
}

/* ---------- اللغة الإنجليزية ---------- */
.auth-tools { display: flex; gap: 6px; justify-content: flex-end; width: 100%; max-width: 420px; margin-bottom: 8px; }
.lang-btn { font-weight: 700; font-size: 13px; }

body.lang-en .date-nav .icon-btn svg { transform: scaleX(-1); }

/* ---------- معاينة رسالة الحجز وتعديل السعر ---------- */
.msg-box { border: 1px solid var(--teal); border-radius: 14px; background: var(--teal-soft); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.msg-actions { display: flex; gap: 8px; }
.msg-preview { margin: 0; white-space: pre-wrap; word-break: break-word; font: 13px/1.6 ui-monospace, 'IBM Plex Sans Arabic', monospace; background: var(--surface); color: var(--text); border-radius: 10px; padding: 10px 12px; max-height: 320px; overflow: auto; text-align: left; unicode-bidi: plaintext; }
.adj-pair select:first-child { width: auto; }
.adj-pair input { max-width: 110px; }

/* ---------- المساعد الذكي ---------- */
.btn-ai { background: linear-gradient(135deg, #f0eafd, #e2f6f8); border: 1px solid var(--violet); color: var(--violet); font-weight: 600; }
.btn-ai:hover { filter: brightness(0.97); }
.ai-spark { margin-inline-end: 4px; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: middle; }
.ai-answer { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; line-height: 1.8; }
.ai-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- الطباعة / PDF: الجدول فقط ---------- */
@media print {
  .sidebar, .bottom-nav, .topbar, .toolbar, .head-actions, .demo-bar, .page-credit, .more-btn, .row-actions, .scrim, #toasts { display: none !important; }
  .shell, .main-col, .content { display: block !important; padding: 0 !important; margin: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .table-wrap { overflow: visible !important; box-shadow: none !important; }
  table.data { font-size: 11px; }
  .modal-overlay .modal-foot, .modal-head .icon-btn { display: none !important; }
}

/* ---------- الملف الطبي: سلامة المريض، النماذج، الوصفة، المختبر ---------- */
.safety-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 12px; border-radius: 12px; margin: 8px 0; background: var(--ok-bg); color: var(--ok); border: 1px solid currentColor; font-size: 14px; }
.safety-banner.allergic { background: var(--danger-bg); color: var(--danger); }
.safety-banner.unknown { background: var(--warn-bg); color: var(--warn); }
.chronic-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip-mini { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; }
.chip-mini button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.chip-mini.in-pkg { border-color: var(--teal); background: var(--teal-soft); }
.note-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.note-type { display: flex; flex-direction: column; gap: 2px; text-align: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; color: var(--text); }
.note-type small { color: var(--muted); }
.note-type.active { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: var(--teal-soft); }
.cf-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--surface-2); border-radius: 12px; }
.cf-date { display: flex; align-items: center; gap: 6px; }
.cf-steps { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; padding-bottom: 2px; }
.cf-tab { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; cursor: pointer; }
.cf-tab b { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--muted-bg); font-size: 12px; }
.cf-tab.on { border-color: var(--teal); color: var(--teal-strong); background: var(--teal-soft); }
.cf-tab.on b { background: var(--teal); color: #fff; }
.cf-section { margin-bottom: 12px; }
.cf-section h4 { margin: 6px 0; font-size: 14.5px; color: var(--teal-strong); }
.cf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.cf-grid .wide { grid-column: 1 / -1; }
.cf-grid textarea { min-height: 54px; }
.cf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-size: 13.5px; direction: ltr; }
.cf-chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.cf-chips.warn .cf-chip.on, .cf-chip.risk.on { background: var(--danger); border-color: var(--danger); }
.cf-other { margin-top: 6px; }
.cf-checknotes { display: grid; gap: 6px; }
.cf-checknote { display: grid; grid-template-columns: auto 200px 1fr; align-items: center; gap: 8px; direction: ltr; }
.pain-scale { display: flex; flex-wrap: wrap; gap: 4px; direction: ltr; }
.pain-btn { width: 34px; height: 34px; border-radius: 8px; border: 2px solid var(--pc); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; }
.pain-btn.on { background: var(--pc); color: #fff; }
.cf-vitals { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.gcs-row { display: flex; gap: 4px; align-items: center; }
.gcs-row select { padding-inline: 4px; }
.vital-flag { font-size: 11.5px; font-weight: 600; color: var(--warn); }
input.v-warn { border-color: var(--warn) !important; background: var(--warn-bg); }
input.v-crit { border-color: var(--danger) !important; background: var(--danger-bg); }
input.v-crit + .vital-flag { color: var(--danger); }
.cf-table-wrap { overflow-x: auto; }
.cf-table { width: 100%; border-collapse: collapse; direction: ltr; }
.cf-table th, .cf-table td { border: 1px solid var(--border); padding: 3px; font-size: 13px; }
.cf-table th { background: var(--surface-2); }
.cf-table input, .cf-table select { width: 100%; min-width: 70px; padding: 5px 6px; border-radius: 6px; }
.cf-table.grid td:first-child { white-space: nowrap; font-weight: 600; }
.cf-nav { display: flex; justify-content: space-between; margin-top: 8px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.assess-grid { display: grid; gap: 8px; }
.assess-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 8px; }
.wound-box { border: 1px dashed var(--border); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.wound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 8px; }
.rx-entry { display: grid; gap: 8px; padding: 10px; background: var(--surface-2); border-radius: 12px; margin: 8px 0; }
.rx-entry-row { display: grid; grid-template-columns: 2fr 1fr 1.3fr; gap: 8px; }
.rx-lines { padding-inline-start: 22px; display: grid; gap: 6px; }
.rx-lines li { position: relative; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; }
.rx-lines li .icon-btn { position: absolute; inset-inline-end: 4px; top: 4px; }
.rx-en { font-weight: 600; text-align: left; } .rx-ar { color: var(--muted); font-size: 13.5px; }
.lab-form h4 { margin: 12px 0 6px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-summary { position: sticky; top: -16px; z-index: 2; background: var(--surface); border: 1px solid var(--teal); border-radius: 12px; padding: 8px 10px; margin: 8px 0; }
.lab-chosen { display: flex; flex-wrap: wrap; gap: 4px; }
.lab-total { margin: 6px 0 0; } .lab-pkg-info { margin: 6px 0 0; font-size: 13.5px; }
.lab-catalog { display: grid; gap: 6px; margin-top: 6px; }
.lab-cat summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.lab-tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px; }
.lab-test { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; align-items: center; gap: 0 6px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.lab-test input { grid-row: span 2; }
.lab-test small { grid-column: 2; color: var(--muted); }
.lab-test em { grid-row: span 2; font-style: normal; font-weight: 700; color: var(--teal-strong); }
.lab-test.on { border-color: var(--teal); background: var(--teal-soft); }
@media (max-width: 640px) {
  .cf-grid, .rx-entry-row { grid-template-columns: 1fr; }
  .cf-checknote { grid-template-columns: auto 1fr; } .cf-checknote input:last-child { grid-column: 1 / -1; }
  .assess-row { grid-template-columns: 1fr; }
}

/* ---- خدمة العملاء: عروض الأسعار، العقود، مؤشرات الصفحات ---- */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; border-inline-start: 4px solid var(--info); }
.kpi b { font-size: 22px; line-height: 1.2; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi-ok { border-inline-start-color: var(--ok); }
.kpi-warn { border-inline-start-color: var(--warn); }
.kpi-danger { border-inline-start-color: var(--danger); }
.contract-cell { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.cprog { height: 5px; border-radius: 3px; background: var(--muted-bg); overflow: hidden; }
.cprog span { display: block; height: 100%; background: var(--info); }
.cprog-ok span { background: var(--ok); }
.cprog-warn span { background: var(--warn); }
.cprog-danger span { background: var(--danger); }
.cprog-muted span { background: var(--muted); }
.quote-form { display: flex; flex-direction: column; gap: 12px; }
.quote-lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.quote-lines th, .quote-lines td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.quote-lines th { color: var(--muted); font-weight: 600; font-size: 13px; }
.q-price { width: 90px; }
.quote-lines td:not(:first-child) { white-space: nowrap; }
.fixed-price { color: var(--warn); }
.quote-summary { display: grid; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.quote-summary > div { display: flex; justify-content: space-between; gap: 10px; }
.quote-summary .grand { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; font-size: 16px; }
.quote-summary .grand b { color: var(--teal-strong); font-size: 20px; }
.mini-chip.campaign { background: var(--violet-bg); color: var(--violet); border-color: transparent; font-weight: 600; }
.cust-msgs { flex-wrap: wrap; align-items: center; margin-top: 8px; }
.sync-plan { margin-top: 10px; }
.compact-list { margin: 6px 0; padding-inline-start: 20px; max-height: 260px; overflow: auto; font-size: 13px; line-height: 1.8; }
@media (max-width: 640px) {
  .quote-lines thead { display: none; }
  .quote-lines tr { display: grid; grid-template-columns: 1fr auto; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .quote-lines td { border: 0; padding: 2px 4px; }
}

/* ---- الموارد البشرية: البطاقة السرّية، الملفات، اختبار المهارات ---- */
.banner.info { background: var(--info-bg); color: var(--info); }
.file-field { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.file-field input[type=file] { font-size: 13px; max-width: 100%; }
.hr-card { border-inline-start: 4px solid var(--violet); }
.hr-card h2 small { font-weight: 400; font-size: 12px; }
.hr-grid { box-shadow: none; border: 0; padding: 0; margin: 0; }
.leave-balance.danger-text { color: var(--danger); font-weight: 600; }
.policy-box { margin-top: 12px; font-size: 13px; }
.policy-box ul { margin: 6px 0; padding-inline-start: 20px; line-height: 1.9; }
.test-cover { text-align: center; padding: 20px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.test-bar { position: sticky; top: -1px; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-radius: 10px; background: var(--teal-soft); margin-bottom: 10px; }
.test-bar.warn { background: var(--warn-bg); color: var(--warn); }
.test-bar.urgent { background: var(--danger-bg); color: var(--danger); }
.test-clock { font-size: 20px; font-variant-numeric: tabular-nums; }
.test-q { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }
.test-q legend { font-weight: 600; padding: 0 4px; }
.test-opt { display: flex; gap: 8px; align-items: center; padding: 4px 2px; cursor: pointer; }
.test-task { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.test-task h4 { margin: 0; }
.test-task p { margin: 0; }
.test-bubble { background: var(--ok-bg); border-radius: 12px; padding: 8px 12px; max-width: 90%; }
.test-review li { margin-bottom: 6px; }
.test-review li.ok b { color: var(--ok); }
.test-review li.bad b { color: var(--danger); }

/* ---- المستودع وحقيبة الطوارئ ---- */
.kit-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.kit-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.kit-batch { display: grid; grid-template-columns: minmax(80px, 1fr) auto auto 90px; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px dashed var(--border); }
.kit-batch input { width: 90px; }
.kit-banner { flex-wrap: wrap; }
.kit-banner .btn { margin-inline-start: auto; }
@media (max-width: 640px) { .kit-batch { grid-template-columns: 1fr auto; } }
.stamp-thumb { max-height: 70px; max-width: 160px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* ---- مخطط الملاحظة التمريضية: NEWS2 والمقاييس ---- */
.news2-box { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.news2-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 16px; }
.news2-box .banner { margin: 0; }
.ok-text { color: var(--ok); font-weight: 600; }
.score-tool { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; margin-top: 8px; }
.score-tool summary { cursor: pointer; font-weight: 600; }
.score-tool .form-grid { margin-top: 8px; }
.gp-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gp-hint { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* ---- المصروفات ---- */
.report-summary { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; line-height: 1.9; }
.trend { display: flex; gap: 10px; align-items: flex-end; height: 140px; padding: 6px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend-col span { display: block; width: 100%; max-width: 46px; background: var(--teal); border-radius: 6px 6px 0 0; min-height: 2px; }
.trend-col small { color: var(--muted); font-size: 11px; }
.block { display: block; }
/* معاينة المدير لدور أو موظف */
.preview-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--violet-bg); color: var(--violet); padding: 6px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.preview-bar > span { flex: 1; min-width: 200px; }
.view-as-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.view-as-row > .btn { min-width: 150px; justify-content: center; }
.view-as-row .mini-chips { flex: 1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; margin: 12px 0; }
.warn-text { color: var(--warn); font-weight: 600; }
/* التقويم الشهري */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cm-head { text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cm-day { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 96px; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: start; cursor: pointer; font: inherit; color: inherit; overflow: hidden; }
.cm-day:hover { border-color: var(--teal); }
.cm-day.other { opacity: 0.45; }
.cm-day.is-today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cm-num { font-weight: 700; }
.cm-count { color: var(--teal); font-size: 11.5px; }
.cm-ev { font-size: 11.5px; border-inline-start: 3px solid var(--c); padding-inline-start: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .cm-day { min-height: 64px; padding: 4px; } .cm-ev { display: none; } }
.file-no.compound { color: var(--violet); }
.supply-picker { display: flex; flex-direction: column; gap: 8px; }
.supply-row .qty-in { width: 64px; text-align: center; }
.cf-supplies { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; }
.cf-supplies summary { cursor: pointer; font-weight: 600; }
.cf-supplies[open] summary { margin-bottom: 8px; }
/* مساحة شارة Netlify العائمة (الخطة المجانية) — تُلغى من config.js بعد الاشتراك */
body { --badge-space: 0px; }
body.badge-safe { --badge-space: 54px; }
body.badge-safe .sidebar { padding-bottom: var(--badge-space); }
body.badge-safe .content { padding-bottom: calc(32px + var(--badge-space)); }
body.badge-safe .modal-overlay { padding-bottom: calc(16px + var(--badge-space)); }
body.badge-safe .modal { max-height: calc(100vh - 32px - var(--badge-space)); }
@media (max-width: 760px) {
  body.badge-safe .bottom-nav { padding-bottom: calc(6px + var(--badge-space) + env(safe-area-inset-bottom)); }
  body.badge-safe .page-credit { padding-bottom: calc(84px + var(--badge-space) + env(safe-area-inset-bottom)); }
  body.badge-safe .modal-overlay { padding-bottom: 0; }
  body.badge-safe .modal { max-height: 94vh; }
  body.badge-safe .modal-foot { padding-bottom: calc(14px + var(--badge-space)); }
}
/* المحاسبة */
.acc-filter { max-width: 520px; margin-bottom: 12px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0; }
.acc-grid .card { padding: 14px 16px; }
.trend2 .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.trend2 .bars span { flex: 1; max-width: 18px; }
.trend2 .bars .out, .dot.out { background: var(--amber, #d97706); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--teal); vertical-align: middle; }
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
.logo-link { display: inline-flex; align-items: center; }
