/* رنّة — نظام التصميم المشترك */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Readex+Pro:wght@400;500;600;700;800&display=swap');

:root {
  /* ألوان المحل (تتغير من لوحة التحكم) */
  --brand: #0f4c5c;
  --brand-2: #f4b942;
  --on-brand: #ffffff;
  --on-brand-2: #13161b;
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-2-soft: color-mix(in srgb, var(--brand-2) 18%, white);

  /* محايدات باردة */
  --ink: #13161b;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --surface: #ffffff;
  --canvas: #edf1f4;

  --ok: #0e9f6e;
  --ok-soft: #e3f6ee;
  --warn: #d48806;
  --warn-soft: #fdf3dc;
  --danger: #d64545;
  --danger-soft: #fbe9e9;

  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --display: 'Readex Pro', 'IBM Plex Sans Arabic', 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --shadow: 0 1px 2px rgb(19 22 27 / .04), 0 8px 24px -12px rgb(19 22 27 / .12);
  --shadow-lg: 0 24px 60px -24px rgb(19 22 27 / .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-2) 80%, var(--brand)); outline-offset: 2px; border-radius: 6px; }

/* ---------- أزرار ---------- */
.btn {
  --b: var(--brand); --t: var(--on-brand);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 12px; border: 0;
  background: var(--b); color: var(--t); font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s var(--ease), box-shadow .2s, filter .2s, background .2s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.accent { --b: var(--brand-2); --t: var(--on-brand-2); }
.btn.ok { --b: var(--ok); --t: #fff; }
.btn.danger { --b: var(--danger); --t: #fff; }
.btn.quiet { --b: var(--line-2); --t: var(--ink); }
.btn.outline { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 14px; padding: 0 26px; }
.btn.sm { min-height: 36px; font-size: 13.5px; padding: 0 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- حقول ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-2); }
.field small { display: block; color: var(--muted); margin-top: 5px; font-size: 12.5px; }
.input, .field input:not([type=color]):not([type=file]), .field select, .field textarea, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line); transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, textarea.input:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
[dir=rtl] input[dir=ltr] { text-align: left; }

/* ---------- بطاقات ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.live { animation: live 2s infinite; }
@keyframes live { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- شعار المحل ---------- */
.mark {
  width: var(--s, 56px); height: var(--s, 56px); border-radius: calc(var(--s, 56px) * .3);
  display: grid; place-items: center; overflow: hidden; flex: none;
  background: var(--brand); color: var(--on-brand);
  font-family: var(--display); font-weight: 700; font-size: calc(var(--s, 56px) * .42);
}
.mark img { width: 100%; height: 100%; object-fit: cover; background: #fff; }

/* ---------- شاشة الدخول ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate .card { width: 100%; max-width: 380px; padding: 32px 28px; text-align: center; }
.gate h1 { font-size: 22px; margin: 16px 0 4px; }
.gate .mark { margin: 0 auto; }
.gate .err { color: var(--danger); font-size: 14px; min-height: 22px; margin-top: 10px; }
.pin-input { text-align: center; font-family: var(--display); font-size: 26px !important; letter-spacing: .4em; }

/* ---------- تنبيه علوي ---------- */
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: #7a4f00; }
.banner.danger { background: var(--danger-soft); color: #8a2020; }
.banner.info { background: var(--brand-soft); color: var(--brand); }

/* ---------- إشعار مؤقت ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: 24px; margin: auto; width: max-content; max-width: calc(100% - 32px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 100;
  box-shadow: var(--shadow-lg); animation: toast .3s var(--ease);
}
@keyframes toast { from { transform: translateY(12px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* iPhone يكبّر الصفحة إذا خط الحقل أصغر من 16 */
@media (max-width: 640px) {
  .input, .field input, .field select, .field textarea, textarea.input { font-size: 16px; }
}

/* ---------- "تم تطوير النظام بواسطة" ---------- */
.credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; font-size: 12.5px; line-height: 1.5; color: inherit; opacity: .8; text-align: center; }
.credit img { width: 28px; height: 28px; padding: 3px; border-radius: 8px; background: #fff; box-sizing: border-box; flex: none; }
.credit a { color: inherit; font-weight: 700; text-decoration: none; }
.credit a:hover, .credit a:focus-visible { text-decoration: underline; }
.credit .ph { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.credit.compact { font-size: 11.5px; gap: 2px 8px; }
.credit.compact img { width: 22px; height: 22px; padding: 2px; border-radius: 6px; }
