/* ════════════════════════════════════════════════════════════════
   Goustenu · owner — أنماط لوحة المالك
   ================================================================
   بنفسجيّ لا أحمر: لوحة المطعم حمراء، وهذه تحذف مستأجرين. التمييز
   البصريّ الفوريّ حاجزٌ أوّل ضدّ «تصرّفتُ في اللوحة الخطأ».

   الأصناف المطلوبة من العدّة المشتركة (`shared/ui-kit.mjs`): `.toast` ·
   `.modal-overlay/.modal-card/.modal-head/.modal-body/.modal-actions` ·
   `.confirm-msg` · `.btn` · `.field` · `.lbl` · `.hint` · `.field-row` ·
   `.icon-btn` — ناقصُها يعني عنصراً عريان وقت التأكيد قبل الحذف.
   ════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --accent: #5B4794;          /* بنفسجيّ المالك */
  --accent-d: #46356f;
  --accent-soft: #ece8f6;
  --bg: #faf7f4;
  --card: #ffffff;
  --ink: #2a2320;
  --muted: #8a807a;
  --line: #e8e1db;
  --ok: #2E6B41;
  --warn: #8A5A12;
  --err: #A63D2F;
  --r: 14px;
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;   /* أرقام الأيّام والمبالغ بعرض ثابت */
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.hint { display: block; font-size: .78rem; color: var(--muted); margin-top: var(--s3); }

/* ─── الأزرار ─── */
.btn {
  min-height: 44px;                     /* هدف لمس مقبول */
  padding: 0 var(--s4);
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: var(--err); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: .85rem; }
.btn.block { width: 100%; margin-top: var(--s3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ─── الحقول ─── */
.field {
  width: 100%;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.lbl { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: var(--s3) 0 var(--s1); }
.field-row { margin-bottom: var(--s4); }
.i18n-grid > * { margin-bottom: var(--s2); }
.i18n-more summary { cursor: pointer; color: var(--muted); font-size: .85rem; }

/* ─── شاشة الدخول ─── */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.login-card {
  width: min(24rem, 100%);
  padding: var(--s5);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.login-brand { color: var(--accent); font-weight: 800; letter-spacing: 0; }
.login-title { font-size: 1.35rem; margin-top: var(--s1); }
.login-sub { color: var(--muted); font-size: .88rem; margin: var(--s1) 0 var(--s3); }
.login-error { min-height: 1.2rem; margin: var(--s2) 0 0; color: var(--err); font-size: .85rem; }

/* ─── الشريط العلويّ ─── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s2) var(--s4);
  background: var(--accent);
  color: #fff;
}
.topbar-brand { font-weight: 800; }
.topbar-role { margin-inline-start: var(--s2); opacity: .85; font-size: .85rem; }
.topbar-actions { display: flex; gap: var(--s2); }
.topbar .btn.ghost { border-color: rgba(255, 255, 255, .45); color: #fff; }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.wrap { max-width: 60rem; margin-inline: auto; padding: var(--s4); }

/* ─── الإحصاءات ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.stat-card {
  padding: var(--s3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-align: center;
}
.stat-val { font-size: 1.5rem; font-weight: 800; }
.stat-lbl { font-size: .78rem; color: var(--muted); }

/* ─── تنبيه انتهاء الاشتراك ─── */
.alert {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--warn);
  border-radius: var(--r);
  background: #fff8ec;
  margin-bottom: var(--s4);
}
.alert h3 { font-size: .95rem; }
.alert ul { margin: var(--s2) 0 0; padding-inline-start: var(--s4); font-size: .88rem; }

/* ─── الترويسة والتصفية ─── */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3);
}
.card-title { font-size: 1.1rem; }
.filters { display: flex; gap: var(--s1); flex-wrap: wrap; }
.chip {
  min-height: 36px; padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ─── قائمة المطاعم ─── */
.rest-list { display: flex; flex-direction: column; gap: var(--s3); }
.rest-row {
  padding: var(--s3) var(--s4);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
/* المُعطَّل والمحذوف يُقرأان قبل النصّ: الحالة أهمّ من الاسم في لوحة إدارة. */
.rest-row.is-suspended { background: #fbf6ef; border-inline-start: 4px solid var(--warn); }
.rest-row.is-deleted { background: #fbf1ef; border-inline-start: 4px solid var(--err); opacity: .85; }

.rest-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.rest-name { font-weight: 700; }
.rest-id { font-size: .78rem; color: var(--muted); }
.rest-meta { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: var(--s1); }
.rest-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }

.badge {
  display: inline-block; padding: .1rem var(--s2); border-radius: 999px;
  font-size: .75rem; font-weight: 700;
}
.badge.active { background: #e8f3ec; color: var(--ok); }
.badge.grace { background: #fdf1dd; color: var(--warn); }
.badge.expired { background: #fbeae7; color: var(--err); }
.badge.suspended { background: #f0eaf8; color: var(--accent-d); }

/* الأمر الجاهز للنسخ (الحدّ المعماريّ: النشر في الطرفيّة) */
.cmd {
  display: block; margin-top: var(--s2); padding: var(--s2) var(--s3);
  background: #f4f1ee; border: 1px dashed var(--line); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem; overflow-x: auto; white-space: pre; direction: ltr; text-align: left;
}

/* ─── toast + modal (تستعملهما العدّة المشتركة) ─── */
.toast {
  position: fixed; inset-inline: 0; bottom: var(--s4);
  margin-inline: auto; width: fit-content; max-width: 90%;
  padding: var(--s2) var(--s4); border-radius: 999px;
  background: #2a2320; color: #fff; font-size: .9rem;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
  z-index: 60;
}
.toast.show { opacity: 1; visibility: visible; }
.toast-err { background: var(--err); }

.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: var(--s4);
  background: rgba(24, 17, 12, .5);
}
.modal-card {
  width: min(30rem, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: var(--r);
}
.modal-card.wide { width: min(44rem, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 1rem; }
.modal-body { padding: var(--s4); }
.modal-actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s4); }
.confirm-msg { margin: 0; line-height: 1.6; }
body.modal-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}
