/* ============================================================
   رواق | RWAQ WORKSPACE — نظام إدارة مساحة العمل
   واجهة عربية RTL — وضع نهاري وليلي — متجاوبة مع الموبايل
   ============================================================ */

/* ---------- المتغيرات: الوضع النهاري ---------- */
:root {
  --navy:        #2c3e5d;
  --navy-700:    #22314a;
  --navy-300:    #5b6b86;
  --gold:        #c0a268;
  --gold-soft:   #e8dcc4;

  --bg:          #f2f4f8;
  --surface:     #ffffff;
  --surface-2:   #f8fAfc;
  --border:      #e4e8ef;
  --text:        #1f2a44;
  --text-soft:   #6b7689;
  --text-faint:  #9aa3b2;

  --green:       #16a34a;
  --green-bg:    #ecfdf3;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --blue:        #2563eb;
  --blue-bg:     #eff6ff;
  --amber:       #d97706;
  --amber-bg:    #fffbeb;
  --purple:      #7c3aed;
  --purple-bg:   #f5f3ff;

  --shadow-sm:   0 1px 2px rgba(31,42,68,.06);
  --shadow:      0 4px 16px rgba(31,42,68,.08);
  --shadow-lg:   0 18px 50px rgba(31,42,68,.18);

  --radius:      16px;
  --radius-sm:   10px;
  --sidebar-w:   248px;
  --topbar-h:    62px;
}

/* ---------- الوضع الليلي ---------- */
[data-theme="dark"] {
  --navy:        #3d5480;
  --navy-700:    #34486e;
  --navy-300:    #8ea2c4;
  --gold:        #d4b884;
  --gold-soft:   #3a3324;

  --bg:          #11151f;
  --surface:     #1a2030;
  --surface-2:   #212838;
  --border:      #2c3547;
  --text:        #e8ecf4;
  --text-soft:   #9aa6bd;
  --text-faint:  #6f7c94;

  --green-bg:    #0f2a1c;
  --red-bg:      #2c1618;
  --blue-bg:     #14213d;
  --amber-bg:    #2b2110;
  --purple-bg:   #201a3a;

  --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
  --shadow:      0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:   0 18px 50px rgba(0,0,0,.55);
}

/* ---------- أساسيات ---------- */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.4; }
p  { margin: 0 0 8px; }
a  { color: var(--navy); text-decoration: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ============================================================
   شاشة الدخول
   ============================================================ */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(192,162,104,.18), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(44,62,93,.16), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  padding: 34px 28px 28px;
  border: 1px solid var(--border);
}

.login-logo { display: block; width: 132px; height: 160px; margin: 0 auto 14px; object-fit: contain; }
.login-title { text-align: center; font-size: 20px; color: var(--navy); margin-bottom: 22px; }
.login-sub {
  text-align: center; color: var(--text-faint); font-size: 12px;
  letter-spacing: 3px; margin-bottom: 22px; font-weight: 600;
}

.login-hint {
  margin-top: 18px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--amber-bg); color: var(--amber);
  font-size: 12px; line-height: 1.9; text-align: center;
}
.login-hint code {
  background: rgba(0,0,0,.07); padding: 1px 7px; border-radius: 5px;
  font-family: ui-monospace, monospace; direction: ltr; display: inline-block;
}

/* ============================================================
   الهيكل العام
   ============================================================ */
.app { display: none; min-height: 100dvh; }
.app.ready { display: block; }

/* الشريط العلوي */
.topbar {
  position: fixed; top: 0; inset-inline: 0; height: var(--topbar-h); z-index: 60;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.topbar-brand img { width: 34px; height: 34px; object-fit: contain; }
.topbar-name { font-weight: 700; color: var(--navy); font-size: 16px; white-space: nowrap; }
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-soft);
  display: grid; place-items: center; cursor: pointer; font-size: 17px;
  transition: .15s; flex: none;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
  border-radius: 30px; background: var(--surface-2); border: 1px solid var(--border);
}
.user-chip .av {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; background: var(--navy); flex: none;
}
.user-chip .nm { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .rl { font-size: 10.5px; line-height: 1.2; }

.role-manager   { color: var(--purple); }
.role-supervisor{ color: var(--blue); }
.role-employee  { color: var(--green); }
.av.manager     { background: var(--purple); }
.av.supervisor  { background: var(--blue); }
.av.employee    { background: var(--green); }

/* مؤشر الشيفت */
.shift-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px;
  border-radius: 30px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
}
.shift-pill.on  { background: var(--green-bg); color: var(--green); border-color: rgba(22,163,74,.25); }
.shift-pill.off { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
.shift-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.shift-pill.on .dot { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* القائمة الجانبية */
.sidebar {
  position: fixed; top: var(--topbar-h); inset-inline-end: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-inline-start: 1px solid var(--border);
  padding: 14px 10px; overflow-y: auto; z-index: 50;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; margin-bottom: 3px;
  border-radius: 12px; color: var(--text-soft); cursor: pointer;
  font-weight: 600; font-size: 14px; transition: .15s; border: 0; width: 100%;
  background: transparent; font-family: inherit; text-align: start;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item .ic { font-size: 17px; width: 22px; text-align: center; flex: none; }

.nav-sep { height: 1px; background: var(--border); margin: 11px 6px; }

/* منطقة المحتوى */
.main {
  padding: calc(var(--topbar-h) + 18px) 18px 30px;
  margin-inline-end: var(--sidebar-w);
  max-width: 1500px;
}

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { font-size: 21px; color: var(--navy); }
.page-sub { color: var(--text-faint); font-size: 12.5px; margin-top: -3px; }
.page-head .grow { flex: 1; }

/* الشريط السفلي للموبايل */
.bottom-nav { display: none; }

/* ============================================================
   البطاقات والجداول
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-head .grow { flex: 1; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

/* بطاقات الإحصائيات */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 4px; background: var(--c, var(--navy));
}
.stat .lbl { color: var(--text-soft); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 25px; font-weight: 700; color: var(--c, var(--text)); line-height: 1.35; margin-top: 2px; }
.stat .sub { color: var(--text-faint); font-size: 11.5px; }
.stat.green  { --c: var(--green); }
.stat.red    { --c: var(--red); }
.stat.blue   { --c: var(--blue); }
.stat.amber  { --c: var(--amber); }
.stat.purple { --c: var(--purple); }
.stat.gold   { --c: var(--gold); }

/* الجداول */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--surface-2); color: var(--text-soft); font-weight: 700; font-size: 12.5px;
  text-align: start; padding: 11px 13px; white-space: nowrap;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
tbody td { padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
td.wrap { white-space: normal; min-width: 170px; }

.empty { text-align: center; padding: 40px 18px; color: var(--text-faint); }
.empty .ic { font-size: 40px; display: block; margin-bottom: 8px; opacity: .55; }

/* الشارات */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 30px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge.green  { background: var(--green-bg);  color: var(--green); }
.badge.red    { background: var(--red-bg);    color: var(--red); }
.badge.blue   { background: var(--blue-bg);   color: var(--blue); }
.badge.amber  { background: var(--amber-bg);  color: var(--amber); }
.badge.purple { background: var(--purple-bg); color: var(--purple); }
.badge.gray   { background: var(--surface-2); color: var(--text-soft); }

/* ============================================================
   الأزرار والنماذج
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px; border-radius: 12px; border: 1px solid transparent;
  background: var(--navy); color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover    { background: var(--navy-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold     { background: var(--gold); }
.btn.gold:hover { filter: brightness(.94); }
.btn.ghost    { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--border); }
.btn.danger   { background: var(--red); }
.btn.sm       { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block    { width: 100%; }
.btn.icon     { padding: 7px 10px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* أزرار الإجراءات السريعة */
.quick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.quick button {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--text);
  transition: .15s; text-align: start;
}
.quick button:hover { border-color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick button .ic {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  font-size: 17px; background: var(--surface-2); flex: none;
}

/* النماذج */
.field { margin-bottom: 13px; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 700; color: var(--text-soft); margin-bottom: 5px;
}
.field .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

input[type=text], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=month], input[type=search], select, textarea {
  width: 100%; padding: 10px 13px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: 14px; transition: .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--navy); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(44,62,93,.1);
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }
input[type=date], input[type=time], input[type=month] { direction: ltr; text-align: start; }

/* اختيار ملف (التصدير والاستيراد) */
input[type=file] {
  width: 100%; padding: 8px 10px; border-radius: 11px;
  border: 1px dashed var(--border); background: var(--surface-2);
  color: var(--text-soft); font-family: inherit; font-size: 13px; cursor: pointer;
}
input[type=file]:hover { border-color: var(--navy); }
input[type=file]::file-selector-button {
  margin-inline-end: 10px; padding: 6px 13px; border-radius: 8px; border: 0;
  background: var(--navy); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}

.grid2 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 0 12px; grid-template-columns: repeat(3, 1fr); }

.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); cursor: pointer; }

/* شريط الفلاتر */
.filters {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 14px;
}
.filters input, .filters select { width: auto; min-width: 135px; }
.filters .grow { flex: 1; }

/* التبويبات */
.tabs {
  display: flex; gap: 5px; margin-bottom: 15px; background: var(--surface);
  padding: 5px; border-radius: 13px; border: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 15px; border-radius: 9px; border: 0; background: transparent;
  color: var(--text-soft); font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.tab:hover  { color: var(--text); }
.tab.active { background: var(--navy); color: #fff; }

/* أزرار الفترات */
.periods { display: flex; gap: 6px; flex-wrap: wrap; }
.period {
  padding: 7px 14px; border-radius: 30px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft);
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.period:hover   { border-color: var(--navy); color: var(--text); }
.period.active  { background: var(--navy); color: #fff; border-color: var(--navy); }
.period:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   النوافذ المنبثقة والتنبيهات
   ============================================================ */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,22,38,.55); backdrop-filter: blur(3px);
  z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); margin: auto 0; animation: pop .18s ease-out;
  border: 1px solid var(--border);
}
.modal.wide { max-width: 840px; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98) } }

.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { flex: 1; font-size: 16px; color: var(--navy); }
.modal-body { padding: 18px; max-height: 68vh; overflow-y: auto; }
.modal-foot {
  display: flex; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 20px 20px;
}
.modal-foot .btn { flex: 1; }

/* ملخص التكلفة الحي داخل النوافذ */
.calc-box {
  background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 13px; padding: 13px; margin: 13px 0;
}
.calc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.calc-row.total {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 9px;
  font-weight: 700; font-size: 16px; color: var(--navy);
}
.calc-row .k { color: var(--text-soft); }

/* صندوق ما دفعه العميل (الوقت / المشروبات / السناكس) */
.charge-box {
  background: var(--surface-2); border: 1px solid var(--gold);
  border-radius: 14px; padding: 14px; margin: 14px 0;
}
.charge-title {
  font-weight: 700; font-size: 13.5px; color: var(--navy);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.charge-box .field { margin-bottom: 6px; }
.charge-box input { background: var(--surface); font-weight: 700; font-size: 15px; }
.charge-box .calc-row.total { margin-top: 8px; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--gold); font-family: inherit; font-size: 11.5px; font-weight: 700;
  text-decoration: underline;
}
.link-btn:hover { color: var(--navy); }

/* اختيار أصناف المطبخ */
.kitchen-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.kit-item {
  border: 1px solid var(--border); border-radius: 11px; padding: 9px; background: var(--surface-2);
  cursor: pointer; text-align: center; transition: .15s; user-select: none;
}
.kit-item:hover  { border-color: var(--gold); }
.kit-item.on     { border-color: var(--gold); background: var(--gold-soft); }
.kit-item .n     { font-size: 12.5px; font-weight: 700; }
.kit-item .p     { font-size: 11px; color: var(--text-soft); }
.kit-item .qty   { font-size: 11.5px; font-weight: 700; color: var(--gold); margin-top: 3px; }

/* التنبيهات */
.toasts {
  position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--green);
  border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 600; max-width: 330px; animation: slide .22s ease-out;
}
.toast.err  { border-inline-start-color: var(--red); }
.toast.info { border-inline-start-color: var(--blue); }
@keyframes slide { from { opacity: 0; transform: translateX(-16px) } }

/* ============================================================
   الرسوم البيانية (CSS)
   ============================================================ */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 95px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: var(--surface-2); border-radius: 30px; height: 10px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 30px; background: var(--navy);
  transition: width .5s cubic-bezier(.4,0,.2,1); min-width: 2px;
}
.bar-fill.gold   { background: var(--gold); }
.bar-fill.green  { background: var(--green); }
.bar-fill.blue   { background: var(--blue); }
.bar-fill.purple { background: var(--purple); }
.bar-fill.red    { background: var(--red); }
.bar-val { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-lbl { color: var(--text-soft); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* رسم الاتجاه اليومي */
.trend { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.trend-bar { background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .4s; }
.trend-bar.exp { background: var(--red); opacity: .8; }
.trend-lbl { font-size: 9.5px; color: var(--text-faint); text-align: center; margin-top: 4px;
             white-space: nowrap; overflow: hidden; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-soft); margin-top: 8px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-inline-end: 5px; }

/* ============================================================
   عناصر مساعدة
   ============================================================ */
.muted   { color: var(--text-soft); }
.faint   { color: var(--text-faint); }
.small   { font-size: 12px; }
.bold    { font-weight: 700; }
.money   { font-variant-numeric: tabular-nums; font-weight: 700; }
.pos     { color: var(--green); }
.neg     { color: var(--red); }
.center  { text-align: center; }
.mt      { margin-top: 14px; }
.mb      { margin-bottom: 14px; }
.nowrap  { white-space: nowrap; }
.flex    { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.grow    { flex: 1; }

.spinner {
  width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; animation: spin .7s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg) } }

.list-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }

/* صفوف الإعدادات القابلة للتعديل */
.cfg-row {
  display: grid; gap: 8px; align-items: center; margin-bottom: 8px;
  grid-template-columns: 1fr 110px 110px 40px;
}
.cfg-row.two { grid-template-columns: 1fr 110px 40px; }
.cfg-row.one { grid-template-columns: 1fr 40px; }
.cfg-row input { margin: 0; }
/* اسم غير قابل للتعديل داخل صفحة الأسعار */
.cfg-row input:disabled {
  background: transparent; border-color: transparent; color: var(--text); font-weight: 700;
}
/* كتلة الشرائح الزمنية لكل مساحة */
.tier-block {
  border: 1px solid var(--border); border-radius: 13px;
  padding: 12px 14px; margin-bottom: 12px; background: var(--surface-2);
}
.tier-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tier-head b { font-size: 14.5px; color: var(--navy); }
.tier-head .btn { margin-inline-start: auto; }
.tier-block .cfg-row { margin-bottom: 6px; }
.tier-block input { background: var(--surface); }

.cfg-del {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--red-bg); color: var(--red); cursor: pointer; font-size: 15px;
  display: grid; place-items: center;
}
.cfg-del:hover { background: var(--red); color: #fff; }

/* ============================================================
   الموبايل والتابلت
   ============================================================ */
@media (max-width: 980px) {
  :root { --topbar-h: 58px; }

  .sidebar { display: none; }
  .main {
    margin-inline-end: 0;
    padding: calc(var(--topbar-h) + 14px) 12px calc(74px + env(safe-area-inset-bottom, 0px));
  }
  .topbar-name { font-size: 15px; }
  .user-chip .nm, .user-chip .rl { display: none; }
  .user-chip { padding: 4px; }

  .bottom-nav {
    display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom, 0px));
    overflow-x: auto; scrollbar-width: none; gap: 3px;
  }
  .bottom-nav::-webkit-scrollbar { display: none; }
  .bnav {
    flex: 1 0 auto; min-width: 66px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px; border: 0; background: transparent; border-radius: 11px;
    color: var(--text-faint); font-family: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer;
  }
  .bnav .ic { font-size: 18px; }
  .bnav.active { color: var(--navy); background: var(--surface-2); }

  .stats { grid-template-columns: repeat(auto-fit, minmax(142px, 1fr)); gap: 9px; }
  .stat .val { font-size: 21px; }
  .page-title { font-size: 18px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 88px 1fr 78px; font-size: 12px; }
  .modal { max-width: 100%; }
  .modal-body { max-height: 62vh; }
  .toasts { inset-inline: 12px; bottom: 82px; }
  .toast { max-width: 100%; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .quick { grid-template-columns: 1fr; }
}

/* ============================================================
   الطباعة / تصدير PDF
   ============================================================ */
@media print {
  .topbar, .sidebar, .bottom-nav, .toasts, .no-print,
  .btn, .periods, .filters, .tabs, .quick { display: none !important; }

  body { background: #fff; color: #000; font-size: 12px; }
  .main { margin: 0; padding: 0; max-width: 100%; }
  .card, .stat {
    box-shadow: none; border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid;
  }
  .stats { grid-template-columns: repeat(4, 1fr); }
  table { font-size: 11px; }
  thead th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head { display: block !important; text-align: center; margin-bottom: 16px; }
  a[href]::after { content: ''; }
}

.print-head { display: none; }
