/* نظام التصميم -- مصدر كل لونٍ وانحناءٍ وظلٍّ وحركة.

   القاعدة (فلسفة أبل للزجاج السائل): المحتوى مسطّحٌ هادئ، والزجاج لطبقة التنقل
   فقط -- شريط التبويبات، والنوافذ المنبثقة من أسفل، والتنبيهات. زجاجٌ فوق زجاج
   يضيّع القراءة، فلا يُوضع.

   لا لون مكتوب خارج هذا الملف: كل مكوّن يقرأ متغيراً من هنا، فتغيير اللون
   بمكانٍ واحد يغيّره بكل الصفحات وبالوضعين. */

:root {
  color-scheme: light;
  /* الأرضية: رمل الغسق الفاتح */
  --bg: #efe9e2;
  --bg-glow-1: #f0cd9c;     /* ضوء الغروب أسفل */
  --bg-glow-2: #dbe5f4;     /* سماء أعلى */
  --surface: rgba(255, 255, 255, .66);
  --surface-solid: #ffffff;
  --surface-edge: rgba(255, 255, 255, .85);
  --fill: rgba(118, 118, 128, .12);
  --line: rgba(60, 60, 67, .14);
  --fg: #1b140c;
  --fg-2: rgba(60, 50, 40, .74);
  --fg-3: rgba(60, 50, 40, .52);
  --gold: #8f6409;           /* ذهب الشعار، مُغمَّقٌ ليقرأ على الفاتح */
  --on-gold: #ffffff;
  --ok: #248a3d;
  --warn: #b25000;
  --bad: #d70015;
  --chrome: rgba(255, 255, 255, .72);
  --chrome-edge: rgba(0, 0, 0, .07);
  --chrome-shine: rgba(255, 255, 255, .75);
  --shadow-1: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px -14px rgba(60, 40, 10, .28);
  --shadow-2: 0 12px 34px -12px rgba(0, 0, 0, .32);
  --scrim: rgba(0, 0, 0, .28);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-pill: 999px;
  --gap: 14px;
  --font: system-ui, -apple-system, "SF Arabic", "Geeza Pro", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --press: 100ms;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0c11;
    --bg-glow-1: #7d4a1f;
    --bg-glow-2: #1b2440;
    --surface: rgba(46, 46, 52, .52);
    --surface-solid: #1c1c1f;
    --surface-edge: rgba(255, 255, 255, .13);
    --fill: rgba(118, 118, 128, .24);
    --line: rgba(84, 84, 88, .55);
    --fg: #f5f1ea;
    --fg-2: rgba(235, 230, 220, .72);
    --fg-3: rgba(235, 230, 220, .5);
    --gold: #f0b93a;
    --on-gold: #1a1200;
    --ok: #30d158;
    --warn: #ff9f0a;
    --bad: #ff453a;
    --chrome: rgba(40, 40, 46, .66);
    --chrome-edge: rgba(255, 255, 255, .15);
    --chrome-shine: rgba(255, 255, 255, .12);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -16px rgba(0, 0, 0, .7);
    --shadow-2: 0 14px 38px -12px rgba(0, 0, 0, .7);
    --scrim: rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0c11; --bg-glow-1: #7d4a1f; --bg-glow-2: #1b2440;
  --surface: rgba(46, 46, 52, .52); --surface-solid: #1c1c1f; --surface-edge: rgba(255, 255, 255, .13);
  --fill: rgba(118, 118, 128, .24); --line: rgba(84, 84, 88, .55);
  --fg: #f5f1ea; --fg-2: rgba(235, 230, 220, .72); --fg-3: rgba(235, 230, 220, .5);
  --gold: #f0b93a; --on-gold: #1a1200; --ok: #30d158; --warn: #ff9f0a; --bad: #ff453a;
  --chrome: rgba(40, 40, 46, .66); --chrome-edge: rgba(255, 255, 255, .15); --chrome-shine: rgba(255, 255, 255, .12);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -16px rgba(0, 0, 0, .7);
  --shadow-2: 0 14px 38px -12px rgba(0, 0, 0, .7); --scrim: rgba(0, 0, 0, .5);
}

/* ---------- الأساس ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: 400 16px/1.55 var(--font);
  color: var(--fg);
  background:
    radial-gradient(95% 55% at 82% 108%, var(--bg-glow-1), transparent 70%),
    radial-gradient(85% 50% at 8% -5%, var(--bg-glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
[hidden] { display: none !important; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(120px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* ---------- الخط ---------- */
.title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.h2 { font-size: 20px; line-height: 1.25; font-weight: 700; margin: 0; }
.sub { color: var(--fg-2); margin: 0; }
.label { font-size: 13px; color: var(--fg-3); font-weight: 500; }
.big { font-size: 34px; font-weight: 700; line-height: 1; }

/* ---------- السطوح ---------- */
.card {
  background: var(--surface);
  border: .5px solid var(--surface-edge);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--chrome-shine), var(--shadow-1);
  padding: 16px;
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chrome {
  background: var(--chrome);
  border: .5px solid var(--chrome-edge);
  box-shadow: inset 0 1px 0 var(--chrome-shine), var(--shadow-2);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}
@media (prefers-reduced-transparency: reduce) {
  .card, .chrome { background: var(--surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row > .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: .5px solid var(--line); min-width: 0; text-align: start; width: 100%; }
.list > .item:last-child { border-bottom: 0; }

/* ---------- الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: var(--r-pill);
  background: var(--gold); color: var(--on-gold); font-weight: 600; font-size: 17px;
  transition: scale var(--press) ease-out, opacity .2s;
  width: 100%;
}
.btn:active { scale: .96; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.soft { background: var(--fill); color: var(--gold); }
.btn.danger { background: var(--fill); color: var(--bad); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.inline { width: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--gold); flex: none; }
.icon-btn:active { scale: .94; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- الحقول ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 50px; border-radius: var(--r-sm); border: 0;
  background: var(--fill); padding: 12px 14px; font-size: 17px;   /* ١٧ لا أقل: الآيفون يكبّر الصفحة لو أقل من ١٦ */
}
.field textarea { min-height: 84px; resize: vertical; }
.error { color: var(--bad); font-size: 14px; }

/* ---------- الشارات والمفاتيح ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; background: var(--fill); color: var(--fg-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }

.switch { position: relative; width: 51px; height: 31px; border-radius: var(--r-pill); background: var(--fill); flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: translate .3s var(--ease); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { translate: -20px 0; }

.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--fill); border-radius: var(--r-sm); padding: 3px; flex: none; }
.stepper button { width: 36px; height: 36px; border-radius: 9px; font-size: 20px; font-weight: 600; color: var(--gold); }
.stepper button:active { background: var(--fill); }
.stepper output { min-width: 32px; text-align: center; font-weight: 600; }

/* ---------- الأختام ---------- */
.stamps { display: grid; gap: 8px; justify-items: center; padding: 12px; border-radius: var(--r-md); background: var(--fill); }
.stamps img { width: 100%; max-width: 60px; aspect-ratio: 1; border-radius: 50%; outline: 1px solid rgba(0,0,0,.08); outline-offset: -1px; transition: opacity .4s, filter .4s; }
.stamps img.off { opacity: .2; filter: grayscale(1); }

/* ---------- طبقة التنقل (الزجاج) ---------- */
.tabbar {
  position: fixed; inset-inline: 18px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  max-width: 520px; margin: 0 auto;
  display: flex; justify-content: space-around; padding: 5px; border-radius: var(--r-pill);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--fg-3); padding: 6px 10px; border-radius: var(--r-pill); min-width: 56px; transition: color .2s, background .25s; }
.tabbar button[aria-current="page"] { color: var(--gold); background: var(--fill); }

.scrim { position: fixed; inset: 0; z-index: 30; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; inset-inline: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 31;
  max-width: 560px; margin: 0 auto; max-height: 86dvh; overflow-y: auto;
  border-radius: 38px; padding: 10px 20px 22px;
  translate: 0 110%; visibility: hidden;
  /* مخفيةٌ تماماً وهي مقفلة -- الإزاحة وحدها تُبقي طرفها ظاهراً لو كانت قصيرة.
     والإخفاء يتأخر حتى تنتهي حركة النزول. */
  transition: translate .45s var(--ease), visibility 0s linear .45s;
  display: flex; flex-direction: column; gap: 14px;
}
.sheet::before { content: ""; width: 38px; height: 5px; border-radius: 9px; background: var(--fg-3); opacity: .5; align-self: center; flex: none; }
.sheet.on { translate: 0 0; visibility: visible; transition: translate .45s var(--ease), visibility 0s; }

.toast {
  position: fixed; inset-inline: 16px; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 40;
  max-width: 520px; margin: 0 auto;
  border-radius: var(--r-pill); padding: 12px 18px; display: flex; gap: 12px; align-items: center; font-size: 15px;
  translate: 0 -160%; opacity: 0; visibility: hidden;
  transition: translate .45s var(--ease), opacity .25s, visibility 0s linear .45s;
}
.toast.on { translate: 0 0; opacity: 1; visibility: visible; transition: translate .45s var(--ease), opacity .25s, visibility 0s; }
.toast .act { color: var(--gold); font-weight: 700; flex: none; }

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

/* أعمدة الأختام: كلاساتٌ لا تنسيقٌ داخل الوسم (سياسة المحتوى تمنع الثاني). */
.cols-2 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); } .cols-5 { grid-template-columns: repeat(5, 1fr); }
.cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ---------- صفحة التسجيل ---------- */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-top: 8px; }
.hero-logo { width: 148px; height: 148px; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .35)); }
/* «.field select» أدق من «.country» وكانت تفرض عرضاً كاملاً، فانزاحت خانة الجوال برا الشاشة. */
.field .country { width: auto; flex: none; }
.num-input { direction: ltr; text-align: right; }
.consent { font-size: 14px; color: var(--fg-2); align-items: flex-start; }
.consent input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; margin-top: 1px; }
.consent a { color: var(--gold); }
.trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.btn.wallet { background: #000; color: #fff; }
.done { align-items: stretch; text-align: center; }
a.btn { text-decoration: none; }

/* ---------- صفحة حسابي ---------- */
.center { align-items: center; text-align: center; }
.state-logo { width: 88px; height: 88px; }
.free { text-align: center; padding: 14px; border-radius: var(--r-md); font-size: 20px; font-weight: 700;
        color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.select { user-select: all; }
.history-kind { font-weight: 600; }

/* ---------- لوحة المسؤول ---------- */
.hero-logo.small { width: 104px; height: 104px; }
.center-text { text-align: center; }
.pin { letter-spacing: .4em; }
.notice { flex-direction: row; align-items: center; justify-content: space-between; color: var(--warn); font-weight: 600; text-align: start; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; background: var(--gold); opacity: .32; min-height: 3px; }
.bar.peak i { opacity: 1; }
.bar.today span { color: var(--fg); font-weight: 600; }
.bar span { font-size: 10px; color: var(--fg-3); white-space: nowrap; }
.bar b { font-size: 11px; color: var(--fg-2); font-weight: 600; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--gold); font-weight: 700; flex: none; }

/* ---------- المسح ---------- */
.viewfinder { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #000;
              display: grid; place-items: center; max-width: 100%; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder .frame { position: absolute; inset: 18%; border-radius: 24px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35);
                     outline: 3px solid var(--gold); outline-offset: -3px; pointer-events: none; }
.viewfinder .btn { position: relative; z-index: 1; }
.viewfinder.live .btn { display: none; }
.who { display: flex; align-items: center; gap: 12px; }
.who .avatar { width: 52px; height: 52px; font-size: 20px; }
.free-big { text-align: center; padding: 18px; border-radius: var(--r-md); font-size: 22px; font-weight: 700;
            color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* ---------- شرائح الفلترة والإعدادات ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 8px 14px; border-radius: var(--r-pill); background: var(--fill); color: var(--fg-2); font-size: 14px; }
.chips button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; min-width: 0; }
.setting-row > .grow { flex: 1; min-width: 0; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl-item { display: flex; gap: 8px; align-items: flex-start; }
.tpl-item textarea { flex: 1; min-height: 56px; }
.hint { font-size: 12px; color: var(--fg-3); }
.link-box { direction: ltr; text-align: left; font-size: 13px; padding: 12px; border-radius: var(--r-sm); background: var(--fill);
            word-break: break-all; user-select: all; }
.row.wrap { flex-wrap: wrap; }
.stack.end { align-items: flex-end; gap: 4px; }

/* ---------- معرض التصاميم ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.design { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: var(--r-md); background: var(--fill);
          text-align: start; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .2s; }
.design[aria-pressed="true"] { outline-color: var(--gold); }
.design img { width: 100%; border-radius: 10px; aspect-ratio: 375 / 144; object-fit: cover; }
.design span { font-size: 14px; font-weight: 600; padding-inline: 4px; display: flex; justify-content: space-between; gap: 6px; }
.preview-big { width: 100%; border-radius: 14px; }
.notice-card { background: color-mix(in srgb, var(--gold) 12%, var(--surface)); }
.bars.hours { gap: 2px; height: 90px; } .bars.hours .bar span { font-size: 9px; }
.bars.hours .bar i { border-radius: 2px 2px 1px 1px; }
.prose ul { margin: 0; padding-inline-start: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.prose li { color: var(--fg-2); }
