/* ═══ التصميم الجديد (تجريبي) — يُحمَّل فوق app.css لمن فعّله ═══
   كل شيء هنا إضافي: لا يُحذف صنف قائم ولا يتغير أي مسار عمل. */

:root {
  --copper: #b08d57;
  --copper-soft: #f7f1e8;
  --primary-dark: #0e161f;
  --st-ready: #1e8449; --st-dirty: #b7950b; --st-cleaning: #2471a3;
  --st-inspect: #8e44ad; --st-oos: #b03a2e; --st-dueout: #c2661a;
  --tap: 44px;
  --topbar-h: 64px;   /* ارتفاع الشريط الثابت — يعتمد عليه العمود الجانبي */
}

/* ═══ وضوح حقول الإدخال — يسري على كل صفحات النظام ═══
   المشكلة: حدّ الحقل #dde3e8 يعطي تبايناً 1.29:1 والمعيار (WCAG 1.4.11) يوجب 3:1،
   فالمربع شبه غير مرئي. والنص الثانوي كان 3.43:1 والمطلوب 4.5:1. */
:root {
  --field-border: #8592a1;   /* تباين 3.17:1 على أبيض ✅ */
  --muted: #66727f;          /* تباين 4.91:1 على أبيض ✅ */
}
input, select, textarea {
  border: 1px solid var(--field-border);
  background: #fff;
}
input:hover:not(:disabled), select:hover:not(:disabled) { border-color: #6b7a8b; }
input:focus, select:focus, textarea:focus {
  border-color: var(--copper); outline: none;
  box-shadow: 0 0 0 3px rgba(176, 141, 87, .22);
}
input:disabled, select:disabled { background: #f2f4f6; color: var(--muted); }
input::placeholder { color: #8a95a2; }   /* واضح لكنه لا يُخلط بالنص المكتوب */

/* حدود دنيا تمنع انسحاق الحقول — min-width يتغلب على max-width المكتوب داخل الصفحات
   حسب مواصفة CSS، فتتسع الحقول الضيقة بلا تعديل أي صفحة. */
input[type="number"] { min-width: 96px; }      /* يتسع للرقم بعد سهمَي الزيادة والنقصان */
input[type="date"], input[type="month"] { min-width: 158px; }
input[type="time"] { min-width: 118px; }
input[type="text"], input[type="tel"], input[type="search"], input[type="password"], select { min-width: 118px; }

/* النماذج الأفقية تلتف بدل أن تضغط، والعنوان يلتصق بحقله لا بجاره */
.form-inline { flex-wrap: wrap; gap: 16px; }
.form-inline label { font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.form-inline label + input, .form-inline label + select { margin-inline-start: -9px; }
.form-inline input, .form-inline select { flex: 1 1 auto; }

/* مقاسات موحّدة بدل الأعراض المكتوبة يدوياً داخل الصفحات */
.w-num { max-width: 120px; }
.w-sm  { max-width: 155px; }
.w-md  { max-width: 215px; }
.w-lg  { max-width: 320px; }

/* ── الخط العربي المستضاف ذاتياً ── */
@font-face {
  font-family: 'AlqasrArabic';
  src: url('/fonts/arabic.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
}
body { font-family: 'AlqasrArabic', 'Segoe UI', Tahoma, Arial, sans-serif; }
td, th, .num, .timer, .rcard-num, input, select { font-variant-numeric: tabular-nums; }

/* ── الشريط العلوي: أغمق ليفصل «ديكور النظام» عن «بيانات الغرف» + ثابت عند التمرير ── */
.topbar { background: var(--primary-dark); gap: 8px;
  position: sticky; top: 0; z-index: 300; box-shadow: 0 2px 10px rgba(0,0,0,.28); }
/* الروابط الداخلية (#) لا تختفي خلف الشريط الثابت */
html { scroll-padding-top: calc(var(--topbar-h) + 8px); }
.topbar nav { gap: 8px; }
.topbar nav a { min-height: var(--tap); display: inline-flex; align-items: center; padding: 8px 12px; }
.topbar nav a.active { background: rgba(255,255,255,.14); box-shadow: inset 0 -3px 0 var(--copper); }
:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }

/* ═══ شريط القوائم المنسدلة ═══ */
.menubar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.menutop { color: #fff; text-decoration: none; padding: 10px 14px; border-radius: 8px;
  min-height: var(--tap); display: inline-flex; align-items: center; font-weight: 600; }
.menutop:hover, .menu > summary:hover { background: rgba(255,255,255,.12); }
.menutop.active { background: rgba(255,255,255,.16); box-shadow: inset 0 -3px 0 var(--copper); }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; color: #fff; padding: 10px 14px;
  min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px; font-weight: 600; user-select: none; white-space: nowrap; }
.menu > summary::-webkit-details-marker, .menu > summary::marker { display: none; content: ''; }
.menu[open] > summary { background: var(--copper); color: #fff; }
.menu.active > summary { box-shadow: inset 0 -3px 0 var(--copper); background: rgba(255,255,255,.14); }
.menu.active[open] > summary { background: var(--copper); }

.menu-panel { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 200;
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0,0,0,.22); padding: 8px; min-width: 250px;
  display: flex; flex-direction: column; gap: 2px; animation: menuIn .12s ease-out; }
.menu-panel-end { inset-inline-start: auto; inset-inline-end: 0; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.menu-panel a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text); min-height: 42px; font-size: .95em; white-space: nowrap; }
.menu-panel a:hover { background: var(--copper-soft); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-panel form { margin: 4px; }

/* جرسا الاستقبال: التنبيهات والحجوزات المبدئية */
.menu-bell > summary { font-size: 1.15em; padding-inline: 8px; white-space: nowrap; }
/* الشارة **بجانب** الأيقونة لا فوقها: الموضع المطلق كان يضعها على حافة الزر
   فتبدو ملتصقة بالأيقونة المجاورة، ولا يُعرف لأيّهما هي. */
/* [hidden] من أنماط المتصفح لها نفس الأولوية، وأنماط المؤلف تغلبها —
   فبلا هذا السطر تظهر الشارة بالرقم صفر بدل أن تختفي. */
.bell-count[hidden] { display: none; }
.bell-count { display: inline-block; min-width: 18px; height: 18px; margin-inline-start: 3px;
  padding: 0 5px; border-radius: 9px; background: var(--st-dueout, #b4552a); color: #fff;
  font-size: .56em; font-weight: 700; line-height: 18px; text-align: center; vertical-align: middle; }
.bell-count-blue { background: var(--primary); }
.bell-panel { min-width: 330px; max-width: 440px; max-height: 70vh; overflow-y: auto; }
.bell-panel a { white-space: normal; line-height: 1.55; font-size: .88em; }
.bell-panel .muted { display: block; font-size: .84em; }
.bell-empty { display: block; padding: 10px 12px; color: var(--muted); font-size: .88em; }
.bell-mute { background: none; border: 0; color: #9fb0c0; font-size: 1em; cursor: pointer;
  padding: 0 6px; line-height: 1; }
.bell-mute:hover { color: #fff; }
.bell-mute.is-muted { color: #6b7885; }
/* رجّة قصيرة عند وصول حجز — لمن ينظر للشاشة بلا صوت */
@keyframes bellRing { 0%,100% { transform: none; } 20% { transform: rotate(-14deg); }
  40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(6deg); } }
.bell-ring > summary { animation: bellRing .7s ease-in-out 3; transform-origin: 50% 20%; }
@media (prefers-reduced-motion: reduce) { .bell-ring > summary { animation: none; } }

/* قائمة المستخدم */
.menu-user > summary { flex-direction: column; align-items: flex-end; gap: 0; line-height: 1.3;
  border-inline-start: 1px solid rgba(255,255,255,.18); }
.menu-user .whoami-name { color: #fff; font-weight: 700; font-size: .96em; }
.menu-user .whoami-role { color: #9fb0c0; font-size: .74em; }
.menu-user[open] > summary .whoami-role { color: #f0e6d8; }

@media (max-width: 760px) {
  /* كان position:fixed مع top:calc(100% + 6px) الموروث. والنسبة مع fixed
     تُحسب من ارتفاع **الشاشة** لا من الزرّ، فتُرسم اللوحة أسفل الشاشة كلها
     ولا تُرى: يضغط المستخدم على القائمة فلا يحدث شيء ظاهرياً — وهي مفتوحة.
     نُبقيها absolute ملتصقة بزرّها، ونحدّ عرضها بدل تمديدها. */
  .menu-panel { position: absolute; min-width: 0; width: max-content;
    max-width: min(88vw, 340px); max-height: 70vh; overflow-y: auto; }
  .bell-panel { min-width: 0; max-width: min(88vw, 360px); }
  .menu-user .whoami-role { display: none; }
}

/* ── فصل روابط التنقل عن أزرار الأوامر ── */
.page-head a.btn:not(.btn-primary):not(.btn-danger) {
  background: transparent; color: var(--primary); border: 1px solid var(--border); }
/* شريط أدوات الشاشة: بحث + تاريخ فقط (التنقّل صار في القائمة العلوية) */
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-tools input[type="search"], .page-tools input[type="date"] { min-height: var(--tap); }

/* ── الخريطة: عرض كامل للغرف، والعدّادات شريط أفقي فوقها ── */
.container { max-width: 1760px; }

.map-layout { display: block; }   /* كان عمودين؛ العمود الجانبي أُلغي 2026-08-05 */
.map-main { min-width: 0; }

/* البطاقات الجانبية للتنبيهات */
.side-title { margin: 0 0 8px; font-size: .95em; }
.side-alerts { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow-y: auto; }
.side-alert { display: block; background: #fdf6e0; border: 1px solid var(--warn); border-inline-start: 4px solid var(--st-dueout);
  border-radius: 8px; padding: 8px 10px; font-size: .82em; color: var(--text); text-decoration: none; line-height: 1.5; }
.side-alert:hover { background: #faeec9; }
.side-legend { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.lg { font-size: .72em; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border); }
.lg-free { background: #fff; } .lg-occ { background: var(--primary); color: #fff; }
.lg-res { border: 1px dashed var(--copper); } .lg-out { background: var(--st-dueout); color: #fff; }

/* العدّادات والدليل في صف العنوان بمحاذاة البحث والتاريخ.
   مُدمجة أفقياً (الرقم بجانب الكلمة لا فوقها) لأن الصف يحمل ثمانية عناصر
   إضافة للبحث والتاريخ — والمقاس العمودي كان يكسره سطرين. */
.head-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.map-stats { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.side-legend { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0; }

.sst { background: var(--card, #fff); border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 9px; display: flex; flex-direction: column; line-height: 1.25; }
/* داخل صف العنوان: الرقم بجانب الكلمة — يوفّر نحو 40% من العرض */
.map-stats .sst { flex-direction: row; align-items: baseline; gap: 5px;
  padding: 4px 10px; white-space: nowrap; }
.map-stats .sst b { font-size: 1.15em; }
.sst b { font-size: 1.45em; color: var(--primary); }
.sst span { font-size: .72em; color: var(--muted); }
.sst-warn { background: #fdf6e0; border-color: var(--warn); }
.sst-warn b { color: var(--st-dueout); }

/* العدّاد هو الدليل: لون الصندوق = لون البطاقة في الخريطة.
   الأرقام والكلمات تُلوَّن معاً لأن .sst b و .sst span تُثبّتان لوناً بالاسم. */
.sst-free { background: #fff; }
.sst-occ  { background: var(--primary); border-color: var(--primary); }
.sst-occ b, .sst-occ span { color: #fff; }
.sst-res  { background: #fff; border: 1px dashed var(--copper); }
.sst-res b { color: var(--copper); }
.sst-out  { background: var(--st-dueout); border-color: var(--st-dueout); }
.sst-out b, .sst-out span { color: #fff; }
.sst-gap { margin-inline-start: 10px; }   /* «غير جاهزة» بُعد آخر — تُفصل بمسافة */

/* ── شبكة الغرف: أبعادها تُحسب بالجافاسكربت لتملأ الشاشة تماماً بلا تمرير ──
   المتغيرات أدناه قيم احتياطية إن تعطّل السكربت. */
.map-main { --rc-w: 108px; --rc-h: 58px; --rc-gap: 5px; --rc-num: 1.2em; }
.map-main h2 { margin: 6px 0 3px; font-size: .8em; color: var(--muted); }
.map-main .room-grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--rc-w), 1fr));
  gap: var(--rc-gap); margin-bottom: var(--rc-gap); }
.map-main .rcard { min-height: var(--rc-h); overflow: hidden; }
.map-main .rcard-top { padding: 4px 6px 0; gap: 3px; }
.map-main .rcard-num { font-size: var(--rc-num); }
.map-main .rcard-suite, .map-main .rcard-flag { font-size: .62em; }
.map-main .rcard-guest { padding: 0 6px 2px; font-size: .68em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-main .rcard-bed { padding: 0 6px 3px; font-size: .62em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-main .rcard-strip { height: 6px; }
.map-main .rcard-strip::after { font-size: 7px; top: -2px; inset-inline-end: 4px; }
.map-main .page-head { margin-bottom: 6px; }

/* عند الضغط الشديد تُخفى الأسطر الثانوية ليبقى الرقم والحالة مقروءين */
.map-main.nohead h2 { display: none; }
.map-main.nohead .room-grid { margin-bottom: 6px; }
.map-main.tight .rcard-bed { display: none; }
.map-main.tighter .rcard-guest { font-size: .62em; }


@media (max-height: 800px) {
  .sst { padding: 5px 8px; }
  .sst b { font-size: 1.25em; }
}
/* شاشة أضيق: الصف ينزل سطراً منظّماً بدل أن يتبعثر — page-tools تلفّ أصلاً */
@media (max-width: 1400px) {
  .map-stats .sst span { font-size: .68em; }
  .map-stats .sst { padding: 4px 7px; }
}
@media (max-width: 1100px) {
  .map-stats, .side-legend { flex-basis: 100%; }
}

/* ═══ شاشة الحجز: شريط التنقّل بعدّاد الحجز ═══ */
.booknav { display: flex; align-items: center; gap: 6px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.bn { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 6px 14px;
  border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--primary);
  text-decoration: none; font-weight: 600; white-space: nowrap; }
.bn:hover { background: var(--copper-soft); border-color: var(--copper); }
.bn-off { opacity: .38; pointer-events: none; }
.bn-new { background: var(--copper); border-color: var(--copper); color: #fff; margin-inline-start: auto; }
.bn-new:hover { background: #9c7a46; }
.bn-mid { flex: 1; text-align: center; font-size: .95em; }
.bn-mid b { font-size: 1.1em; }

/* ═══ نموذج الحجز: عمودان — النموذج يميناً ومعلومات الغرفة يساراً ═══ */
.book-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.book-main { min-width: 0; }
.book-side { min-width: 0; }
.book-side .note { font-size: .85em; padding: 8px 10px; }
.book-side .side-title { font-size: .9em; margin: 4px 0 6px; }
.tbl-slim { font-size: .82em; }
.tbl-slim th, .tbl-slim td { padding: 5px 7px; }

/* حقلان في سطر واحد بدل سطرين — يقصّر النموذج للنصف */
.book-main .fpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: end; }
.book-main .fcell { min-width: 0; }
.book-main .form label { margin-top: 8px; font-size: .88em; }
.book-main .form > label:first-of-type { margin-top: 0; }
.book-main .form input, .book-main .form select { margin-top: 2px; }
.book-main .session-actions { margin-top: 14px; }

@media (max-width: 1200px) {
  .book-layout { grid-template-columns: 1fr; }
  .book-main .fpair { grid-template-columns: 1fr; }
}

/* ═══ شاشة القبض: الرصيد أولاً ثم سند القبض ═══ */
.due-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-radius: 12px; padding: 12px 18px; margin-bottom: 14px; border: 1px solid var(--border); background: #fff; }
.due-open { background: #fdecea; border-color: var(--danger); }
.due-clear { background: #eafaf1; border-color: var(--ok); }
.due-main { display: flex; align-items: baseline; gap: 10px; }
.due-lbl { font-size: .9em; color: var(--muted); }
.due-num { font-size: 2.6em; font-weight: 800; line-height: 1; }
.due-open .due-num { color: var(--danger); }
.due-clear .due-num { color: var(--ok); }
.due-cur { font-size: .95em; color: var(--muted); }
.due-side { display: flex; align-items: center; gap: 16px; font-size: .9em; flex-wrap: wrap; }
.due-side b { font-size: 1.15em; }
.due-chip { background: var(--danger); color: #fff; border-radius: 20px; padding: 1px 9px; font-size: .82em; margin-inline-start: 6px; }

.pay-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pay-main { order: -1; min-width: 0; }   /* سند القبض يميناً وهو الأهم */
.pay-side { min-width: 0; }
.pay-side .form { padding: 0; }
.pay-side h2 { margin: 12px 0 6px; }
.pay-side .form-inline { gap: 5px; }
.pay-side .form-inline input, .pay-side .form-inline select { max-width: 100% !important; flex: 1 1 90px; }

/* نموذج القبض بارز: حقل المبلغ كبير وزر واضح */
.pay-form { background: #fff; border: 1px solid var(--copper); border-radius: 12px; padding: 14px; gap: 8px; }
.pay-form #pay-amount { max-width: 150px !important; font-size: 1.5em; font-weight: 700; min-height: 52px; }
.pay-form .btn-primary { min-height: 52px; padding: 0 22px; font-size: 1.05em; }

@media (max-width: 1200px) { .pay-layout { grid-template-columns: 1fr; } }

/* ── الحالات: لون + أيقونة (دعم عمى الألوان) + إصلاح سماكة الشريط ── */
.rcard-strip { height: 9px; position: relative; }
.strip-ready { background: var(--st-ready); height: 9px; }
.strip-needs_cleaning { background: var(--st-dirty); }
.strip-cleaning { background: var(--st-cleaning); }
.strip-pending_inspection { background: var(--st-inspect); }
.rcard-strip::after { position: absolute; inset-inline-end: 6px; top: -1px; font-size: 9px; color: #fff; font-weight: 700; }
.strip-ready::after { content: '✓ جاهزة'; }
.strip-needs_cleaning::after { content: '✦ تنظيف'; }
.strip-cleaning::after { content: '⟳ جارٍ'; }
.strip-pending_inspection::after { content: '◎ تفتيش'; }
.strip-out_of_service::after { content: '✕ خارج الخدمة'; }

/* «تغادر اليوم» برتقالي مستقل — النحاسي يعود للفخامة فقط (جناح/ملكية) */
.rcard-dueout::before { background: var(--st-dueout); height: 6px; }
.rcard-dueout .rcard-flag { color: var(--st-dueout); }

/* ── لمس مريح ── */
.btn { min-height: var(--tap); }
.btn-sm { min-height: 36px; }
.btn-punch { min-height: 56px; }
input, select { min-height: var(--tap); }

/* ═══ نافذة الحجز فوق الخريطة ═══
   البنية عمود مرن: الرأس ثابت والجسم يمرّر — بلا اعتماد على sticky. */
.book-dlg { border: none; border-radius: 14px; padding: 0;
  width: 900px; max-width: 94vw; max-height: 88vh; background: #fff;
  overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); color: var(--text);
  margin: auto; }
/* مغلقة ⇒ مخفية تماماً (لا تظهر أسفل الصفحة)، ومفتوحة ⇒ عمود مرن */
.book-dlg:not([open]) { display: none; }
.book-dlg[open] { display: flex; flex-direction: column; }
.book-dlg::backdrop { background: rgba(14,22,31,.55); }
.dlg-head { flex: 0 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; background: var(--primary-dark); color: #fff;
  padding: 10px 16px; }
.dlg-head b { font-size: 1.05em; color: #fff; }
#dlg-body { flex: 1 1 auto; padding: 14px 16px 18px; overflow-y: auto; min-height: 120px; }
#dlg-body .form { border: none; padding: 0; max-width: 100%; }
#dlg-body .fpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: end; }
/* منتقي الغرفة في شاشة الحجز */
.room-pick-row { padding: 6px 0; gap: 10px; }
#room-pick { font-weight: 600; }
.room-pick-info { white-space: nowrap; }

/* شريط العدّاد داخل النافذة */
.pn-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 10px; }
.pn-nav .bn { font-size: .9em; }
.pn-nav .bn-mid { flex: 1; text-align: center; font-size: .9em; }

/* تبويبات اللوحة */
.pn-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.pn-tab { border: none; background: transparent; cursor: pointer; font: inherit; color: var(--muted);
  padding: 9px 14px; border-radius: 8px 8px 0 0; min-height: var(--tap);
  border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; }
.pn-tab:hover { background: var(--copper-soft); color: var(--text); }
.pn-tab.on { color: var(--text); border-bottom-color: var(--copper); background: var(--copper-soft); }
.pn-pane .info-table th { width: 34%; font-size: .86em; color: var(--muted); }
.pn-pane h2, .pn-pane h3 { font-size: .95em; margin: 12px 0 6px; }
.pn-pane .form { max-width: 100%; padding: 10px; }
.pn-pane table { margin-bottom: 10px; }

.night-rule { background: var(--copper-soft); border: 1px solid var(--copper);
  border-radius: 8px; padding: 7px 10px; margin: 8px 0; font-size: .85em; }
.late-out { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 700px) { #dlg-body .fpair { grid-template-columns: 1fr; } }

/* ═══ شاشة التوكيل: تمييز الغرف الموكَّلة ═══ */
.rooms-pick .room-chk { position: relative; min-width: 108px; }
.rc-tag { display: block; font-size: .68em; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.rc-busy { background: #fdf6e0; border-color: var(--copper); }
.rc-busy .rc-tag { color: #8a6d3b; }
.rc-full { opacity: .5; }
.rc-open { background: #eafaf1; border-color: var(--ok); }      /* فُتحت للمشاركة */
.rc-open .rc-tag { color: var(--ok); }
.share-toggle { background: var(--copper-soft); border: 1px solid var(--copper);
  border-radius: 8px; padding: 9px 12px; margin: 10px 0; display: block; }
.rooms-pick input:disabled + span, .rooms-pick label:has(input:disabled) { cursor: not-allowed; }

/* ═══ لوحة الإشراف المضغوطة — نفس مبدأ الخريطة مع مراعاة أزرار البطاقة ═══ */
.hk-main { --rc-w: 120px; --rc-h: 110px; --rc-gap: 6px; --rc-num: 17px; }
.hk-main h3 { margin: 6px 0 3px; font-size: .8em; color: var(--muted); }
.hk-main .room-grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--rc-w), 1fr));
  gap: var(--rc-gap); margin-bottom: var(--rc-gap); }
.hk-main .room { min-height: var(--rc-h); padding: 5px 6px; border-width: 2px;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; overflow: hidden; }
.hk-main .room-num { font-size: var(--rc-num); line-height: 1.15; }
.hk-main .room-st { font-size: .68em; }
.hk-main .room-bed { font-size: .66em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hk-main .room-cleaner { font-size: .66em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hk-main .room-note-sm { font-size: .62em; }
/* قائمة الأسرّة تُخفى على الشاشة الكبيرة (متاحة من جدول الطلبات وصفحة الغرفة) */
.hk-main .bed-form { display: none; }
.hk-main .room-actions { margin-top: auto; gap: 3px; }
.hk-main .room-actions .btn { min-height: 30px; padding: 2px 6px; font-size: .82em; flex: 1; }
.hk-main.tight .room-st { display: none; }
.hk-main.tighter .room-bed, .hk-main.tighter .room-note-sm { display: none; }
.hk-main.nohead h3 { display: none; }
.hk-stats { grid-template-columns: 1fr 1fr; }
.hk-stats .sst:nth-child(5) { grid-column: 1 / -1; }

/* التابلتات: لا ضغط إطلاقاً — مقاسات لمس مريحة كما كانت */
@media (max-width: 1100px) {
  .hk-main .room { min-height: 0; padding: 10px; }
  .hk-main .bed-form { display: block; }
  .hk-main .room-actions .btn { min-height: var(--tap); flex: 1; }
  .hk-main .room-num { font-size: 1.1em; }
  .hk-main .room-st, .hk-main .room-bed, .hk-main .room-cleaner { font-size: .8em; }
}

/* ═══ صفحة الحجز: ثلاثة أعمدة — من هو / ماذا حجز / ماذا أفعل ═══ */
.bk-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: start; margin-bottom: 12px; }
.bk-col { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.bk-h { margin: 0 0 8px; font-size: .92em; padding-bottom: 6px; border-bottom: 2px solid var(--copper); }
.bk-col h3:not(.bk-h) { margin: 12px 0 5px; font-size: .85em; color: var(--muted); }
.bk-col h2 { margin: 12px 0 5px; font-size: .9em; }
.bk-col table { margin-bottom: 8px; border: none; }
.bk-col .info-table th { width: 38%; font-size: .84em; color: var(--muted); font-weight: 600; }
.bk-col .info-table td { font-size: .9em; }
.bk-col th, .bk-col td { padding: 5px 6px; }
.bk-col .form { padding: 8px; margin-bottom: 8px; }
.bk-col .form-inline { padding: 6px 0; gap: 8px; }
.bk-col .note, .bk-col .alert { font-size: .82em; padding: 7px 9px; }
.bk-col .muted { font-size: .84em; }

/* عمود الإجراءات: الأزرار تحت بعضها بعرض كامل ليسهل ضغطها */
.bk-actions .session-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.bk-actions .session-actions > a, .bk-actions .session-actions form { width: 100%; }
.bk-actions .btn-punch { width: 100%; justify-content: center; text-align: center; }
.bk-actions .checkin-form { flex-direction: column; align-items: stretch; }
.bk-actions .checkin-form input { max-width: 100% !important; }
.bk-actions .btn-danger { width: 100%; }
.bk-actions input, .bk-actions select { max-width: 100% !important; }

@media (max-width: 1400px) { .bk-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1000px) { .bk-cols { grid-template-columns: 1fr; } }

/* ═══ الملاحظات والتصحيح ═══ */
.room-note { background: #fdf6e0; border-color: var(--copper); font-size: .88em; }
.rcard-note { cursor: help; }
.room-note-sm { font-size: .72em; color: var(--st-dueout); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: help; }
.edit-box > summary { background: var(--copper-soft); border-color: var(--copper); }
.edit-box .form { border-color: var(--copper); }
.checkin-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cin-lbl { margin-top: 10px; }

/* ═══ سجل الإصدارات في «حول النظام» — عمود بجانب البطاقة ═══ */
.about-layout { display: grid; grid-template-columns: 420px 1fr; gap: 20px;
  align-items: start; max-width: 1200px; margin: 4vh auto 24px; }
.about-layout .login-box { margin: 0; max-width: 100%; }
.ver-box { margin: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
  max-height: calc(100vh - var(--topbar-h) - 90px); overflow-y: auto; }

@media (max-width: 1000px) {
  .about-layout { grid-template-columns: 1fr; max-width: 560px; }
  .ver-box { max-height: none; }
}
.ver-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ver-head h2 { margin: 0; font-size: 1.02em; }
.ver-title { margin: 12px 0; padding-bottom: 8px; border-bottom: 2px solid var(--copper); font-size: 1.05em; }
.ver-group { margin-bottom: 12px; border-inline-start: 4px solid var(--border);
  padding: 6px 12px; border-radius: 6px; background: #fafbfc; }
.ver-group h3 { margin: 0 0 5px; font-size: .9em; }
.ver-group ul { margin: 0; padding-inline-start: 20px; }
.ver-group li { font-size: .9em; line-height: 1.75; }
.vg-add { border-inline-start-color: var(--ok); background: #f3fbf6; }
.vg-change { border-inline-start-color: var(--copper); background: #fdf9f3; }
.vg-fix { border-inline-start-color: var(--st-dueout); background: #fdf6ef; }

/* رقم النسخة في التذييل */
.app-ver { display: inline-block; margin-inline-start: 10px; padding: 2px 10px; border-radius: 20px;
  background: rgba(176, 141, 87, .16); border: 1px solid var(--copper); font-size: .88em; }

.rcard-tent { color: var(--warn, #b7950b); font-weight: 700; }

/* إكمال الحجز المبدئي عند التسكين */
.complete-box { background: #fdf6e0; border: 1px solid var(--warn); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 8px; width: 100%; }
.complete-box .form-inline { padding: 6px 0 2px; gap: 8px; }
.complete-box .muted { font-size: .82em; }
/* تنبيه مهلة منتهية: يبقى حتى يتصرّف الموظف — يطلب قراراً لا إخباراً */
.promise-live { border-inline-start: 5px solid var(--st-dueout); }
.promise-live div { padding: 2px 0; }

/* سطر «سيُسجَّل باسم…» أعلى نموذج الحجز */
.by-note { background: var(--copper-soft); border: 1px solid var(--copper); border-radius: 8px;
  padding: 6px 10px; margin-bottom: 10px; font-size: .86em; }

/* ── مفتاح التصميم ── */
.ui-switch { background: var(--copper-soft); border: 1px solid var(--copper); border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ═══ التصحيح المالي داخل نافذة التعديل ═══ */
.bn-edit { background: var(--copper-soft); border-color: var(--copper); }
.fin-box { margin-top: 14px; border: 2px solid var(--st-dueout); border-radius: 12px;
  padding: 12px 14px; background: #fdf6ef; }
.fin-box h3 { margin: 0 0 4px; font-size: .98em; }
.fin-stay { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 8px; }
.fin-stay:first-of-type { border-top: none; }
.fin-stay .form-inline { padding: 5px 0; gap: 8px; }

/* ── خانة المجموع المالي في نماذج الحجز وإضافة الغرفة ──
   الغرض: ألّا يُقبض ثمن ليلة واحدة سهواً في حجز عدة ليالٍ. */
.sum-box {
  display: inline-flex; align-items: baseline; gap: .4rem;
  padding: .35rem .7rem; border-radius: 8px;
  background: var(--ok-bg, #e8f5ec); border: 1px solid var(--ok, #2e7d4f);
}
.sum-box .sum-lbl { font-size: .85rem; color: var(--muted); }
.sum-box .sum-num { font-size: 1.15rem; font-weight: 700; color: var(--ok, #2e7d4f); }
.sum-box .sum-cur { font-size: .85rem; }

/* ── بوابة التسكين: الزر «مائي» خارج يوم الحجز ──
   معطّل بصرياً ووظيفياً، والسبب والمخرج المشروع بجانبه. */
.btn.btn-locked,
.btn.btn-locked:hover {
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
  box-shadow: none;
}
.gate-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin: .5rem 0; padding: .5rem .75rem;
  border-radius: 8px;
  background: var(--warn-bg, #fdf6e3);
  border: 1px solid var(--warn, #b7950b);
}
.gate-note .gate-msg { font-size: .92rem; }

/* ── شريط الفلترة: يتلوّن حين يكون أي فلتر مفعّلاً ── */
.filter-bar {
  border: 1px solid var(--line, #e2e7e5); border-radius: 10px;
  padding: .6rem .8rem; margin: .6rem 0;
}
.filter-bar.filter-on { border-color: var(--warn, #b7950b); background: var(--warn-bg, #fdf6e3); }
.filter-status {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin: .3rem 0 .8rem; font-size: .93rem;
}
.chip-x { text-decoration: none; }
.chip-x:hover { filter: brightness(.94); }

/* صفوف الأصناف: شبكة ثابتة تعطي محاذاة الجدول مع بقاء التوسّع بلا جافاسكربت */
.item-row { border-bottom: 1px solid var(--line, #e2e7e5); }
.item-row > summary {
  display: grid; align-items: center; gap: .6rem; padding: .45rem .6rem; cursor: pointer;
  grid-template-columns: minmax(12rem, 1fr) 5rem 10rem 9rem 6rem 8rem;
}
.item-row > summary::-webkit-details-marker { display: none; }
.item-row[open] > summary { background: var(--surface-2, #f6f8f7); font-weight: 600; }
.item-head {
  display: grid; gap: .6rem; padding: .4rem .6rem; font-weight: 700; font-size: .88rem;
  grid-template-columns: minmax(12rem, 1fr) 5rem 10rem 9rem 6rem 8rem;
  border-bottom: 2px solid var(--line, #e2e7e5);
}
.item-body { padding: .6rem 1rem 1rem; background: var(--surface-2, #f8faf9); }
@media (max-width: 900px) {
  .item-row > summary, .item-head { grid-template-columns: 1fr auto; }
  .item-head { display: none; }
}

/* ═══ شاشة الأرصدة: شريط حفظ لاصق · صف معدَّل · تسوية مطويّة ═══ */
.save-bar { position: sticky; bottom: 0; z-index: 50; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; background: var(--copper-soft);
  border: 1px solid var(--copper); border-radius: var(--r-md);
  padding: 8px 14px; margin-top: 10px; box-shadow: 0 -6px 18px rgba(0,0,0,.08); }
.row-dirty td { background: var(--warn-bg); }
.adj-box > summary { list-style: none; cursor: pointer; display: inline-flex; }
.adj-box > summary::-webkit-details-marker { display: none; }
.adj-in { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 6px; }
.hidden-form { display: none; }
.min-in { max-width: 90px; }

/* شريط تصفية الأصناف فوق قوائم الطلبات */
.item-filter { margin-bottom: 10px; }
.item-filter .form-inline { gap: 8px; }

/* وميض العنصر الذي عاد إليه المستخدم بعد الإضافة أو الحفظ */
@keyframes anchorFlash { 0%,100% { background: transparent; } 30% { background: #fdf6e0; } }
.anchor-flash td { animation: anchorFlash 2s ease-out; }
@media (prefers-reduced-motion: reduce) { .anchor-flash td { animation: none; } }
