@font-face { font-family: "Janna"; src: url("/assets/janna-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Janna"; src: url("/assets/janna-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --navy: #020F37;
  --navy-2: #0A1E52;
  --navy-3: #13296B;
  --sky: #5AA6E6;
  --sky-2: #3B8BD4;
  --sky-soft: #E7F1FB;
  --paper: #F3F6FB;
  --card: #FFFFFF;
  --ink: #0E1A38;
  --muted: #5B6785;
  --line: #DDE4EF;
  --line-2: #C9D3E3;
  --danger: #C2304A;
  --danger-soft: #FCEBEE;
  --amber: #B7791F;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(2,15,55,.06), 0 8px 24px -12px rgba(2,15,55,.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Janna", "Segoe UI", Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(90,166,230,.55); outline-offset: 2px; }

/* ---------- الدخول ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-brand {
  background: var(--navy);
  color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 32px; position: relative; overflow: hidden;
}
.auth-brand::before, .auth-brand::after {
  content: ""; position: absolute; border: 1.5px solid rgba(90,166,230,.16); border-radius: 50%;
}
.auth-brand::before { width: 620px; height: 620px; top: -260px; inset-inline-start: -240px; }
.auth-brand::after { width: 420px; height: 420px; bottom: -200px; inset-inline-end: -140px; }
.auth-brand img { width: min(340px, 70%); height: auto; position: relative; z-index: 1; }
.auth-brand h1 { font-size: 26px; margin: 18px 0 6px; font-weight: 700; position: relative; z-index: 1; text-align: center; }
.auth-brand p { margin: 0; color: #A9C4E6; position: relative; z-index: 1; text-align: center; }
.auth-brand .depts { display: flex; gap: 10px; margin-top: 28px; position: relative; z-index: 1; flex-wrap: wrap; justify-content: center; }
.auth-brand .depts span { border: 1px solid rgba(90,166,230,.4); color: #CFE2F7; padding: 6px 16px; border-radius: 999px; font-size: 14px; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 24px; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); margin: 0 0 26px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--line-2); background: #fff; border-radius: 10px;
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--sky-2); box-shadow: 0 0 0 4px rgba(90,166,230,.18); outline: none; }
.input[dir="ltr"] { text-align: left; }
.textarea { resize: vertical; min-height: 42px; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 700; font-size: 15px;
  background: var(--navy); color: #fff; transition: background .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--navy-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; padding: 12px; }
.btn.sky { background: var(--sky-2); }
.btn.sky:hover { background: #2E78BF; }
.btn.ghost { background: transparent; color: var(--navy); border: 1.5px solid var(--line-2); }
.btn.ghost:hover { background: var(--sky-soft); border-color: var(--sky); }
.btn.danger { background: transparent; color: var(--danger); border: 1.5px solid #EBC3CB; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- الهيكل ---------- */
.topbar {
  background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(2,15,55,.25);
}
.topbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 8px 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand img { height: 58px; width: auto; display: block; }
.brand b { display: block; font-size: 16px; line-height: 1.3; }
.brand small { display: block; color: #9FB9DD; font-size: 12px; }
.nav { display: flex; gap: 4px; margin-inline-start: 18px; }
.nav a {
  color: #C6D7EE; text-decoration: none; padding: 8px 14px; border-radius: 9px; font-weight: 700; font-size: 14px;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(90,166,230,.18); color: #fff; box-shadow: inset 0 -2px 0 var(--sky); }
.user-menu { margin-inline-start: auto; position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: #fff; padding: 6px 8px 6px 14px; border-radius: 999px;
}
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sky); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.user-btn .who { text-align: start; line-height: 1.25; }
.user-btn .who small { display: block; color: #9FB9DD; font-size: 11px; }
.dropdown {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: #fff; color: var(--ink); border-radius: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 200px; padding: 6px; display: none;
}
.dropdown.open { display: block; }
.dropdown button { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 9px 12px; border-radius: 8px; }
.dropdown button:hover { background: var(--sky-soft); }

main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }

/* ---------- رأس نموذج المرور ---------- */
.round-head { padding: 18px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; align-items: end; margin-bottom: 16px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--paper); padding: 5px; border-radius: 12px; border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; padding: 10px 8px; border-radius: 9px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.seg button.on { background: var(--navy); color: #fff; box-shadow: 0 4px 12px -4px rgba(2,15,55,.5); }
.seg button svg { width: 18px; height: 18px; }
.day-box {
  border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 9px 12px; background: var(--paper); font-weight: 700; color: var(--navy-2);
}
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; align-items: center; }
.summary .stat { background: var(--navy); color: #fff; border-radius: 10px; padding: 6px 14px; font-weight: 700; }
.summary .stat b { color: var(--sky); font-size: 18px; margin-inline-start: 6px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: #F3F6FB; color: var(--c); border: 1px solid #DDE4EF;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); display: inline-block; }
.chip .n { background: var(--c); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }

/* ---------- الغرف ---------- */
.rooms { display: grid; grid-template-columns: 1fr; gap: 14px; }
.room { overflow: visible; }
.room-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.room-no {
  width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #fff; display: grid; place-items: center;
  font-size: 20px; font-weight: 700; flex: none;
}
.room-head .t { font-weight: 700; }
.room-head .t small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.room-head .badge { margin-inline-start: auto; font-size: 13px; color: var(--sky-2); font-weight: 700; }
.bed-cols, .bed {
  display: grid; grid-template-columns: 92px minmax(200px, 1.1fr) minmax(200px, 1.6fr) minmax(160px, 1fr); gap: 10px;
  padding: 10px 16px; align-items: start;
}
.bed-cols { padding-top: 8px; padding-bottom: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.bed { border-top: 1px solid #EEF2F8; position: relative; }
.bed:first-of-type { border-top: 0; }
.bed.filled { background: linear-gradient(to left, rgba(90,166,230,.07), transparent 60%); }
.bed.filled::before { content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--sky-2); }
.bed-label {
  display: inline-flex; align-items: center; justify-content: center; min-width: 64px; height: 40px; padding: 0 10px; border-radius: 10px;
  background: var(--sky-soft); color: var(--navy-2); font-weight: 700; border: 1px solid #CFE2F7;
}
.bed-label.single { background: #EEF1F7; border-color: var(--line); }
.bed-label.iso { background: #FFF4E0; color: #8A5A0B; border-color: #F2D9A8; }
.bed .textarea, .bed .input { min-height: 42px; }

/* القائمة المنسدلة متعددة الاختيار */
.ms { position: relative; }
.ms-btn {
  width: 100%; min-height: 42px; border: 1.5px solid var(--line-2); background: #fff; border-radius: 10px; padding: 6px 10px 6px 34px;
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center; text-align: start; position: relative;
}
.ms-btn:hover { border-color: var(--sky); }
.ms-btn.open { border-color: var(--sky-2); box-shadow: 0 0 0 4px rgba(90,166,230,.18); }
.ms-btn .ph { color: #8A95AE; }
.ms-btn::after {
  content: ""; position: absolute; left: 13px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-left: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg);
}
.ms-pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-start: 0; width: max(100%, 260px); background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(2,15,55,.35); padding: 8px; display: none;
}
.ms-pop.open { display: block; }
.ms-pop .ms-title { font-size: 12px; color: var(--muted); padding: 2px 8px 6px; }
.ms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.ms-opt:hover { background: var(--sky-soft); }
.ms-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ms-opt .box { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; transition: .12s; }
.ms-opt input:checked + .box { background: var(--c); border-color: var(--c); }
.ms-opt input:checked + .box::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px,-1px); }
.ms-opt input:focus-visible + .box { outline: 3px solid rgba(90,166,230,.55); outline-offset: 2px; }
.ms-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.ms-foot button { background: none; border: 0; color: var(--sky-2); font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.ms-foot button:hover { background: var(--sky-soft); }
.other-wrap { margin-top: 6px; }
.other-wrap .input { border-style: dashed; border-color: #C9B27A; background: #FFFCF4; }

.savebar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 35; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -16px rgba(2,15,55,.3);
}
.savebar-inner { max-width: 1280px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.savebar .info { color: var(--muted); font-size: 14px; }
.savebar .info b { color: var(--navy); }
.savebar .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- السجل ---------- */
.filters { padding: 14px 16px; display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.filters .field { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.3; }
.kpi.dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpi.dark .l { color: #9FB9DD; }
.kpi.dark .v { color: var(--sky); }
.list { display: grid; gap: 10px; }
.row-card {
  display: grid; grid-template-columns: 74px 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.row-card:hover { border-color: var(--sky); transform: translateY(-1px); }
.date-tile { background: var(--sky-soft); border-radius: 12px; text-align: center; padding: 6px 4px; color: var(--navy); line-height: 1.2; }
.date-tile b { display: block; font-size: 24px; }
.date-tile small { font-size: 12px; color: var(--muted); }
.row-card .ttl { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dept-tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--navy); color: #fff; }
.dept-tag { background: #2A4FB0; }
.dept-tag.women { background: #3D93D6; }
.row-card .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row-card .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.row-card .count { text-align: center; color: var(--navy); }
.row-card .count b { display: block; font-size: 22px; line-height: 1.1; }
.row-card .count small { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty b { display: block; color: var(--navy); font-size: 18px; margin-bottom: 4px; }

/* ---------- عرض المرور (يشبه النموذج الورقي) ---------- */
.sheet { padding: 28px; }
.sheet-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: 14px; margin-bottom: 14px; }
.sheet-head img { height: 100px; width: auto; }
.sheet-head h2 { margin: 0; font-size: 22px; color: var(--navy); }
.sheet-head .hosp { color: var(--muted); font-size: 14px; }
.sheet-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 14px; font-size: 15px; }
.sheet-meta span b { color: var(--navy); }
table.form { width: 100%; border-collapse: collapse; font-size: 14px; }
table.form th { background: var(--navy); color: #fff; padding: 8px; font-weight: 700; border: 1px solid var(--navy); }
table.form td { border: 1px solid var(--line-2); padding: 6px 8px; vertical-align: top; }
table.form td.room { text-align: center; vertical-align: middle; font-weight: 700; font-size: 18px; background: var(--sky-soft); color: var(--navy); width: 70px; }
table.form td.bedc { text-align: center; width: 70px; font-weight: 700; }
table.form tr.has td:not(.room) { background: #F7FAFE; }
table.form .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 13px; }
.view-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--navy); }

/* ---------- المستخدمون ---------- */
.users-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.users-grid .card { padding: 18px; }
.users-grid h3 { margin: 0 0 14px; font-size: 17px; }
table.users { width: 100%; border-collapse: collapse; }
table.users th { text-align: start; font-size: 13px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
table.users td { padding: 10px 8px; border-bottom: 1px solid #EEF2F8; }
.role { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--sky-soft); color: var(--navy-2); font-weight: 700; }
.role.admin { background: var(--navy); color: #fff; }
.off { color: var(--danger); font-size: 12px; font-weight: 700; }

/* ---------- نافذة منبثقة وتنبيه ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2,15,55,.5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 440px; padding: 22px; box-shadow: 0 30px 60px -20px rgba(2,15,55,.5); }
.modal h3 { margin: 0 0 14px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
#toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff;
  padding: 10px 20px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; font-weight: 700;
  box-shadow: 0 10px 30px -10px rgba(2,15,55,.6); border-inline-start: 4px solid var(--sky);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-inline-start-color: #F08A9C; }
.loading { text-align: center; padding: 60px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--sky-2); animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }


/* ---------- الشكر في النموذج ---------- */
:root { --gold: #B8860B; --gold-soft: #FFF7E0; --gold-line: #EBD39A; }
.bed-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.thx-btn {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  border: 1px dashed var(--gold-line); background: #fff; color: #8A6A12;
}
.thx-btn svg { width: 13px; height: 13px; }
.thx-btn:hover { background: var(--gold-soft); }
.thx-btn[aria-pressed="true"] { background: var(--gold); color: #fff; border-style: solid; border-color: var(--gold); }
.thanks-row { grid-column: 2 / -1; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 12px; padding: 10px 12px; }
.thanks-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #7A5B0C; font-size: 14px; margin-bottom: 8px; }
.thanks-title svg { width: 16px; height: 16px; color: var(--gold); }
.thanks-grid { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: 10px; align-items: start; }
.bed.thanked:not(.filled)::before { content: ""; position: absolute; inset-inline-start: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 4px; background: var(--gold); }
.summary .stat.gold { background: var(--gold); display: inline-flex; align-items: center; gap: 6px; }
.summary .stat.gold b { color: #fff; }
.summary .stat.gold svg { width: 15px; height: 15px; }
table.form td.bedc .star { display: inline-block; vertical-align: middle; margin-inline-start: 4px; color: var(--gold); }
table.form td.bedc .star svg { width: 14px; height: 14px; }
.thx-h { display: flex; align-items: center; gap: 8px; color: #7A5B0C; margin: 22px 0 10px; font-size: 17px; }
.thx-h svg { width: 18px; height: 18px; color: var(--gold); }
table.form.gold th { background: #8A6A12; border-color: #8A6A12; }
table.form.gold td.room { background: var(--gold-soft); color: #7A5B0C; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; margin: 0; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- صفحات التقرير A4 ---------- */
.a4-stage { width: 100%; overflow: hidden; }
.dash-filters .custom[hidden] { display: none; }
.a4-host { width: 794px; transform-origin: top right; }
.a4 {
  width: 794px; height: 1123px; background: #fff; margin: 0 0 20px; box-shadow: 0 10px 30px -14px rgba(2,15,55,.35); border: 1px solid var(--line);
  padding: 40px 44px 30px; display: flex; flex-direction: column; position: relative; overflow: hidden; color: var(--ink); font-size: 12.5px; line-height: 1.55;
}
.a4::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 8px; background: var(--navy); }
.a4::after { content: ""; position: absolute; top: 8px; inset-inline-end: 0; width: 160px; height: 3px; background: var(--sky); }
.a4-body { flex: 1; overflow: hidden; }
.a4-foot { display: flex; justify-content: space-between; padding-top: 8px; margin-top: 8px; color: var(--muted); font-size: 11px; min-height: 24px; }
.r-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px solid var(--navy); }
.r-head img { height: 78px; width: auto; }
.r-date { color: var(--muted); font-size: 14px; font-weight: 700; }
.r-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 10px 14px; background: var(--paper); border-radius: 10px; margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.r-summary b { color: var(--navy); font-size: 15px; margin-inline-start: 4px; }
.r-summary i { font-style: normal; margin: 0 8px; color: var(--line-2); }
.r-empty { padding: 30px; text-align: center; color: var(--muted); font-size: 15px; border: 1px dashed var(--line-2); border-radius: 10px; }
.r-head h1 { margin: 0 0 2px; font-size: 23px; color: var(--navy); line-height: 1.35; }
.r-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.r-meta span { background: var(--sky-soft); border-radius: 7px; padding: 3px 10px; color: var(--muted); font-size: 12px; }
.r-meta b { color: var(--navy); margin-inline-start: 4px; }
.r-mini { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-2); padding-bottom: 8px; margin-bottom: 12px; color: var(--muted); }
.r-mini b { color: var(--navy); }
.r-mini img { height: 40px; }
.r-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.r-kpi { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.r-kpi span { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.r-kpi b { font-size: 24px; color: var(--navy); line-height: 1.3; }
.r-kpi b.sm { font-size: 16px; display: block; padding-top: 6px; white-space: nowrap; }
.r-kpi b small { color: var(--muted); font-size: 12px; }
.r-kpi.dark { background: var(--navy); border-color: var(--navy); }
.r-kpi.dark span { color: #9FB9DD; } .r-kpi.dark b { color: #fff; }
.r-kpi.gold { background: var(--gold-soft); border-color: var(--gold-line); }
.r-kpi.gold b { color: #8A6A12; }
.r-sec { font-weight: 700; color: var(--navy); font-size: 14.5px; margin: 6px 0 8px; padding-inline-start: 10px; border-inline-start: 4px solid var(--sky); }
.r-sec.gold { border-color: var(--gold); color: #7A5B0C; }
.r-bars { display: grid; gap: 5px; margin-bottom: 4px; }
.r-bar { display: grid; grid-template-columns: 90px 1fr 80px; gap: 10px; align-items: center; }
.r-bar .l { font-weight: 700; }
.r-bar .track { height: 12px; background: #EEF2F8; border-radius: 6px; overflow: hidden; display: block; }
.r-bar .track i { display: block; height: 100%; background: var(--navy-3); border-radius: 6px; }
.r-bar .v { font-weight: 700; color: var(--navy); } .r-bar .v small { color: var(--muted); font-weight: 400; }
.r-note { color: var(--muted); font-size: 11px; margin: 4px 0 14px; }
.r-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.r-table th { background: var(--navy); color: #fff; font-weight: 700; padding: 6px 7px; text-align: start; font-size: 12px; }
.r-table.gold th { background: #8A6A12; }
.r-table td { border-bottom: 1px solid var(--line); padding: 6px 7px; vertical-align: top; }
.r-table tr:nth-child(even) td { background: #F8FAFD; }
.r-table.gold tr:nth-child(even) td { background: #FFFBF0; }
.r-table td.c { text-align: center; font-weight: 700; }
.r-table .chip { font-size: 11px; padding: 1px 7px; margin: 1px 0; }
.r-sign { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); }
.r-sign b { color: var(--navy); }

/* ---------- لوحة المدير ---------- */
.dash-filters { padding: 12px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { border: 1.5px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; color: var(--muted); }
.presets button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.dash-filters .custom { display: flex; gap: 8px; align-items: center; }
.dash-filters .custom label { display: flex; gap: 6px; align-items: center; font-weight: 700; font-size: 14px; }
.dash-filters .custom .input { padding: 6px 10px; width: auto; }
.dash-filters .seg { margin-inline-start: auto; }
.range-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.range-note b { color: var(--navy); }
.dkpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 14px; }
.dk { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.dk > span { color: var(--muted); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.dk > span svg { width: 15px; height: 15px; }
.dk > b { font-size: 30px; color: var(--navy); line-height: 1.25; }
.dk > b.sm { font-size: 20px; padding: 6px 0 4px; } .dk > b small { font-size: 14px; color: var(--muted); }
.dk > small { color: var(--muted); font-size: 12px; }
.dk.dark { background: var(--navy); border-color: var(--navy); } .dk.dark > span, .dk.dark > small { color: #9FB9DD; } .dk.dark > b { color: #fff; }
.dk.gold { background: var(--gold-soft); border-color: var(--gold-line); } .dk.gold > b { color: #8A6A12; } .dk.gold > span svg { color: var(--gold); }
.delta { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 1px 8px; align-self: flex-start; }
.delta.good { background: #E7F1FB; color: #1F5FA8; }
.delta.bad { background: #FCEBEE; color: #B42318; }
.delta.same { background: #EEF1F7; color: var(--muted); }
.insight { padding: 16px 18px; margin-bottom: 14px; border-inline-start: 5px solid var(--sky); }
.insight h3 { margin: 0 0 8px; font-size: 17px; color: var(--navy); }
.insight ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.insight li::marker { color: var(--sky-2); }
.insight b { color: var(--navy); }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { padding: 16px 18px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel .ph { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; flex-wrap: wrap; }
.panel h3 { margin: 0; font-size: 17px; color: var(--navy); display: flex; align-items: center; gap: 6px; }
.panel h3 svg { width: 18px; height: 18px; color: var(--gold); }
.panel .ph p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel h4.sub { margin: 16px 0 8px; font-size: 14px; color: var(--navy); }
.legend { display: flex; gap: 14px; font-size: 13px; font-weight: 700; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.hb-row { display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; padding: 5px 0; border-bottom: 1px solid #F0F3F8; }
.hb-row:last-child { border-bottom: 0; }
.hb-l { font-weight: 700; font-size: 14px; }
.hb-bars { display: grid; gap: 3px; }
.hb { display: flex; align-items: center; gap: 8px; min-height: 18px; cursor: default; }
.hb i { display: block; height: 14px; border-radius: 0 4px 4px 0; min-width: 2px; }
.hb span { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.hb span small { color: var(--muted); font-weight: 400; }
.trend { width: 100%; height: auto; display: block; }
.trend .grid line { stroke: #E6EBF3; stroke-width: 1; }
.trend text { font-size: 10px; fill: var(--muted); font-family: inherit; }
.trend .col:hover .hit { fill: rgba(90,166,230,.10); }
.heat { display: grid; gap: 3px; font-size: 13px; }
.heat .hh { font-weight: 700; color: var(--muted); text-align: center; font-size: 12px; padding-bottom: 2px; }
.heat .hr { font-weight: 700; color: var(--navy); align-self: center; font-size: 12.5px; }
.heat .hc { border-radius: 5px; height: 24px; display: grid; place-items: center; font-weight: 700; color: var(--navy); }
.heat .hc.dk { color: #fff; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cmp th { font-size: 12.5px; color: var(--muted); text-align: start; padding: 6px; border-bottom: 1.5px solid var(--line-2); }
table.cmp td { padding: 7px 6px; border-bottom: 1px solid #EEF2F8; }
table.cmp tfoot td { font-weight: 700; border-top: 1.5px solid var(--line-2); border-bottom: 0; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 8px; }
.thanks-panel { border-top: 4px solid var(--gold); }
.thx-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.thx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-height: 520px; overflow: auto; padding: 2px; }
.thx-card { border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: 12px; padding: 10px 12px; }
.thx-card .top { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.thx-card .top .muted { font-weight: 400; margin-inline-start: auto; }
.thx-card p { margin: 6px 0 0; font-size: 14px; }
.thx-card .chips { display: flex; gap: 4px; flex-wrap: wrap; }
#tip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0; transition: opacity .1s; background: var(--navy); color: #fff; padding: 7px 11px;
  border-radius: 9px; font-size: 13px; max-width: 280px; box-shadow: 0 10px 24px -10px rgba(2,15,55,.6);
}
#tip b { display: block; } #tip span { color: #CFE2F7; }
@media (max-width: 1100px) { .dkpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 980px) {
  .dgrid { grid-template-columns: 1fr; } .thx-wrap { grid-template-columns: 1fr; }
  .thanks-row { grid-column: 1 / -1; } .thanks-grid { grid-template-columns: 1fr; }
  .bed-side { flex-direction: row; align-items: center; }
}
@media (max-width: 760px) { .dkpis { grid-template-columns: 1fr 1fr; } .dash-filters .seg { margin: 0; width: 100%; min-width: 0 !important; } .hb-row { grid-template-columns: 84px 1fr; } }

/* ---------- الشاشات الصغيرة ---------- */
@media (max-width: 980px) {
  .round-head { grid-template-columns: 1fr 1fr; }
  .round-head .dept-field { grid-column: 1 / -1; }
  .bed-cols { display: none; }
  .bed { grid-template-columns: 1fr; gap: 8px; }
  .bed > div[data-l]::before { content: attr(data-l); display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
  .users-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 36px 20px; }
  .auth-brand img { width: 200px; }
  .auth-brand h1 { font-size: 21px; }
  .topbar-inner { flex-wrap: wrap; padding: 8px 14px; gap: 8px; }
  .brand img { height: 42px; }
  .brand .txt { display: none; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .nav a { flex: none; }
  .user-btn .who { display: none; }
  .user-btn { padding: 4px; }
  main { padding: 16px 14px 140px; }
  .round-head { grid-template-columns: 1fr; padding: 14px; }
  .row-card { grid-template-columns: 60px 1fr; }
  .row-card .count { display: none; }
  .sheet { padding: 14px; overflow-x: auto; }
  .sheet-head img { height: 64px; }
  table.form { min-width: 640px; }
  .filters { grid-template-columns: 1fr; }
  .ms-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- الطباعة ---------- */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; font-size: 12px; }
  .topbar, .savebar, .no-print, #toast, .page-head { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  .sheet { padding: 0; }
  .sheet-head img { height: 70px; }
  table.form { font-size: 11px; }
  table.form th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.form td.room, .chip, .chip .n { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.form tr { break-inside: avoid; }
  table.form thead { display: table-header-group; }
  .a4-stage { overflow: visible; height: auto !important; }
  .a4-host { transform: none !important; height: auto !important; margin: 0 !important; }
  .a4 { page: report; margin: 0; box-shadow: none; border: 0; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .a4 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .card.empty { display: none; }
  .a4:last-child { break-after: auto; }
  .a4 { height: 296mm; }
  main > .card.empty, .no-print, #tip { display: none !important; }
}
@page report { size: A4 portrait; margin: 0; }
@media print { body.report-mode, body.report-mode * { page: report; } }

/* ---------- لوحة المدير (تصميم هادئ) ---------- */
.dash { max-width: 1040px; margin: 0 auto; }
.dash-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-top h1 { margin: 0; font-size: 24px; color: var(--navy); }
.dash .dash-filters { background: none; border: 0; box-shadow: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dash .presets button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.dash .presets button:hover { background: #E9EEF6; }
.dash .presets button.on { background: #E3ECF8; color: var(--navy); }
.dash-period { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.dash-empty { text-align: center; padding: 56px 20px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 14px; font-size: 16px; }
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.dstat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dstat > span { color: var(--muted); font-size: 14px; }
.dstat > b { font-size: 34px; color: var(--navy); line-height: 1.25; }
.dstat > small { font-size: 12.5px; }
.dstat > small.same { color: var(--muted); }
.dstat > small.good { color: #1F5FA8; }
.dstat > small.bad { color: #B42318; }
.dbox { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 22px; margin-bottom: 14px; min-width: 0; }
.dbox h3 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.box-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.box-h h3 { margin: 0; }
.notes { margin: 0; padding-inline-start: 18px; display: grid; gap: 6px; color: var(--ink); }
.notes li::marker { color: var(--sky-2); }
.notes b { color: var(--navy); }
.sv-row { display: grid; grid-template-columns: 100px 1fr; gap: 14px; align-items: center; padding: 6px 0; }
.sv-l { font-size: 14px; color: var(--ink); }
.sv-bars { display: grid; gap: 4px; }
.sv-bar { display: flex; align-items: center; gap: 8px; }
.sv-bar i { display: block; height: 10px; border-radius: 0 5px 5px 0; min-width: 3px; }
.sv-bar span { font-size: 13px; color: var(--muted); }
.others { margin-top: 10px; padding-top: 10px; border-top: 1px solid #EEF2F8; color: var(--muted); font-size: 13px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.two > .dbox:only-child { grid-column: 1 / -1; }
.rm-row { display: grid; grid-template-columns: 64px 1fr 28px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.rm-t { height: 10px; background: #EEF2F8; border-radius: 5px; overflow: hidden; }
.rm-t i { display: block; height: 100%; background: var(--navy-3); border-radius: 5px; }
.rm-row b { color: var(--navy); text-align: center; }
.thx-rank { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.thx-rank span { background: var(--paper); border-radius: 8px; padding: 3px 10px; font-size: 13px; color: var(--muted); }
.thx-rank b { color: var(--navy); margin-inline-start: 4px; }
.thx-items { max-height: 320px; overflow: auto; }
.thx-item { padding: 9px 0; border-top: 1px solid #EEF2F8; }
.thx-item p { margin: 0; font-size: 14px; }
.thx-item span { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) { .dstats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } .dstat > b { font-size: 26px; } .two { grid-template-columns: 1fr; } .sv-row { grid-template-columns: 80px 1fr; } }

/* ---------- توسيط النصوص داخل الخانات ---------- */
.input, .textarea, .select { text-align: center; text-align-last: center; }
.input::placeholder, .textarea::placeholder { text-align: center; }
.ms-btn { justify-content: center; text-align: center; padding-inline: 34px; }
.day-box { text-align: center; }
.bed-cols > div { text-align: center; }
.kpi { text-align: center; }
.empty { text-align: center; }
.bed-side { align-items: center; }

/* ---------- حلقات النسب ---------- */
.donuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 28px; }
.donut { display: grid; grid-template-columns: 160px 1fr; gap: 18px; align-items: center; }
.donut-svg { width: 160px; height: 160px; }
.donut-svg circle { transition: opacity .15s; }
.donut-svg:hover circle { opacity: .55; } .donut-svg circle:hover { opacity: 1; }
.donut-svg .dc1 { font-size: 11px; fill: var(--muted); font-family: inherit; }
.donut-svg .dc2 { font-size: 22px; font-weight: 700; fill: var(--navy); font-family: inherit; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-width: 220px; }
.donut-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { color: var(--navy); font-weight: 700; }
.donut-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 0; }
.chart-note { margin-top: 12px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------- رسم النقاط ---------- */
.dots { display: grid; gap: 2px; }
.dots-head, .dots-row { display: grid; grid-template-columns: 100px 1fr repeat(2, 56px); gap: 14px; align-items: center; }
.dots-head { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.dots-head .scale { display: flex; justify-content: space-between; }
.dots-head .scale em { font-style: normal; }
.dots-head .dv i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 5px; }
.dots-row { padding: 8px 0; border-top: 1px solid #F0F3F8; }
.dots-row .dl { font-size: 14px; }
.dots-row .dv { font-size: 13px; color: var(--muted); text-align: center; }
.dots-row .track { position: relative; height: 2px; background: #E3E9F2; border-radius: 2px; }
.dots-row .track i { position: absolute; top: -5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(2,15,55,.08); }
.box-sub { margin: -8px 0 10px; color: var(--muted); font-size: 12.5px; }
.rm-list { list-style: none; margin: 0; padding: 0; counter-reset: rm; }
.rm-list li { counter-increment: rm; display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #EEF2F8; font-size: 14px; }
.rm-list li:first-child { border-top: 0; }
.rm-list li::before { content: counter(rm); width: 24px; height: 24px; border-radius: 50%; background: var(--paper); color: var(--muted); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.rm-list li b { margin-inline-start: auto; color: var(--navy); font-weight: 700; }
.donut { grid-template-columns: 160px minmax(0, 210px); justify-content: center; }
.donut { grid-template-columns: 160px minmax(0, 170px); }

.r-by { color: var(--navy); font-size: 13px; margin-top: 2px; }
.user-btn .who { text-align: center; }
.brand .txt { text-align: center; }
.dash .dash-filters { margin-bottom: 16px; }

/* ---------- توسيط كلمة الصلاحية واسم المستشفى في الشريط العلوي (كل الصفحات) ---------- */
.brand .txt { text-align: center; }
.user-btn .who { text-align: center; }
