/* ==========================================================================
   منصة تصويت بلدية خورفكان — الهوية البصرية والأنماط العامة
   Khor Fakkan Municipality Voting Platform — Design System
   ========================================================================== */

:root {
  /* الألوان مستوحاة من شعار البلدية (الأخضر) */
  --green-900: #0c5231;
  --green-800: #0f6b3f;
  --green-700: #12854b;
  --green-600: #16a05a;
  --green-500: #1eb267;
  --green-400: #38c583;
  --green-300: #74d9a8;
  --green-100: #d3efdf;
  --green-050: #eef9f2;
  --mint: #f0faf4;
  --cream: #fbfaf4;
  --gold: #c9a24b;

  --ink: #10211a;
  --muted: #5f6f66;
  --line: #e6ede8;
  --bg: #f1f6f2;
  --card: #ffffff;
  --danger: #d64550;
  --danger-bg: #fdecee;

  --shadow-sm: 0 2px 12px rgba(13, 90, 51, 0.06);
  --shadow: 0 14px 36px rgba(13, 90, 51, 0.10);
  --shadow-lg: 0 30px 72px rgba(13, 90, 51, 0.18);
  --ring: 0 0 0 4px rgba(30, 178, 103, 0.15);
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Tajawal", "Cairo", "Segoe UI", "Noto Kufi Arabic", Tahoma, system-ui, sans-serif;

  /* ---- مقاسات التخطيط المتجاوب ---- */
  --maxw: 1150px;          /* أقصى عرض للمحتوى — يتّسع على الشاشات الكبيرة */
  --gutter: 22px;          /* الهامش الجانبي — يضيق على الجوّال */
  --hdr-h: 78px;           /* ارتفاع الهيدر الفعلي (يضبطه common.js) */
  --tap: 44px;             /* أدنى مقاس مريح للمس */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  /* الحجم الأساسي يبقى 16px على الجوّال والحاسوب المعتاد، ويكبر تدريجياً
     على الشاشات الكبيرة جداً فقط حتى لا تبدو الواجهة ضئيلة عليها. */
  font-size: clamp(16px, 0.95rem + 0.12vw, 18px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
  min-height: 100dvh;
  /* شبكة أمان: لا تمرير أفقي مهما طال محتوى غير متوقّع */
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(1100px 480px at 100% -12%, rgba(56, 197, 131, 0.16), transparent 60%),
    radial-gradient(850px 520px at -12% 3%, rgba(20, 138, 75, 0.10), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1440' height='240' viewBox='0 0 1440 240' preserveAspectRatio='none'%3E%3Cpath fill='%2316a05a' fill-opacity='0.06' d='M0,240 L0,150 C180,90 320,180 520,130 C700,88 820,170 1010,120 C1180,78 1320,150 1440,120 L1440,240 Z'/%3E%3Cpath fill='%230c5231' fill-opacity='0.05' d='M0,240 L0,185 C220,140 360,205 560,170 C760,138 900,200 1080,165 C1260,132 1360,185 1440,170 L1440,240 Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: top right, top left, bottom center;
  background-size: auto, auto, 100% auto;
  background-attachment: fixed;
}
/* التثبيت الخلفي مكلف ومهتزّ على متصفّحات الجوّال (خصوصاً iOS) */
@media (max-width: 1024px), (pointer: coarse) {
  body { background-attachment: scroll; background-size: auto, auto, 160% auto; }
}

/* ---------- الهيدر الرسمي ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(230, 237, 232, 0.8);
  box-shadow: 0 4px 24px rgba(13, 90, 51, 0.04);
}
.site-header .bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;   /* الأدوات تنزل لسطر جديد بدل أن تمدّ الصفحة أفقياً */
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; flex: 1 1 auto; }
.brand img { height: 52px; width: auto; display: block; flex: none; }
.brand .titles { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand .titles b { font-size: 1.05rem; color: var(--green-900); font-weight: 800; }
.brand .titles span { font-size: 0.78rem; color: var(--muted); letter-spacing: .3px; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }

/* الحزام العلوي (شريط لوني رفيع) */
.topline { height: 4px; background: linear-gradient(90deg, var(--green-700), var(--green-400), var(--gold)); }

/* ---------- التخطيط ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 60px; }
.narrow { max-width: 560px; }
.center-screen { position: relative; overflow: hidden; min-height: calc(100dvh - var(--hdr-h)); display: grid; place-items: center; padding: 28px 18px; }
.center-screen::before, .center-screen::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(55px); z-index: 0;
  animation: floaty 10s ease-in-out infinite;
}
.center-screen::before { width: 340px; height: 340px; background: radial-gradient(circle, rgba(56,197,131,.30), transparent 70%); top: -70px; right: -50px; }
.center-screen::after { width: 300px; height: 300px; background: radial-gradient(circle, rgba(201,162,75,.20), transparent 70%); bottom: -80px; left: -50px; animation-delay: -5s; }
.center-screen > * { position: relative; z-index: 1; }

/* ---------- البطاقات ---------- */
.card {
  background: linear-gradient(180deg, #ffffff, #fdfefd);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px;
  transition: box-shadow .25s ease, transform .25s ease;
}
.card.pad-lg { padding: 36px; }
.card-hero {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border-color: rgba(211, 239, 223, 0.9);
}
.card-hero::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--green-700), var(--green-400), var(--gold));
}
.card-hero::after {
  content: "";
  position: absolute; top: -70px; left: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 178, 103, 0.14), transparent 70%);
  pointer-events: none;
}

/* ---------- الأزرار ---------- */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: linear-gradient(135deg, var(--green-700), var(--green-500) 55%, var(--green-400)); color: #fff; box-shadow: 0 10px 22px rgba(20, 138, 75, .30); }
.btn-primary:hover { box-shadow: 0 14px 30px rgba(20, 138, 75, .42); transform: translateY(-2px); }
.btn-ghost { background: var(--green-050); color: var(--green-900); border: 1px solid var(--green-100); }
.btn-ghost:hover { background: var(--green-100); }
.btn-outline { background: transparent; color: var(--green-900); border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--green-400); background: var(--green-050); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fbdfe2; }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- النماذج ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 7px; color: var(--ink); }
input[type=text], input[type=password], input[type=url], input[type=datetime-local], textarea, select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(30, 178, 103, .14);
}
textarea { resize: vertical; min-height: 80px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* ---------- الشارات والحالة ---------- */
/* flex:none يمنع انضغاط الشارة إلى عمود حرف واحد داخل الصفوف المرنة،
   و max-width يمنعها في المقابل من تجاوز عرض الحاوية عندما يطول نصّها. */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; flex: none; max-width: 100%; }
.badge-open { background: var(--green-050); color: var(--green-700); }
.badge-closed { background: #f3f0f0; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--green-500); box-shadow: 0 0 0 0 rgba(30,178,103,.6); animation: pulse 1.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(30,178,103,.55); }
  70% { box-shadow: 0 0 0 9px rgba(30,178,103,0); }
  100% { box-shadow: 0 0 0 0 rgba(30,178,103,0); }
}

/* ---------- التنبيهات ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 15px; font-size: .9rem; font-weight: 600; margin-bottom: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-ok { background: var(--green-050); color: var(--green-700); }

/* ---------- عناوين المقاطع ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.section-title h2 { font-size: 1.35rem; color: var(--green-900); font-weight: 800; }
.eyebrow { color: var(--green-600); font-weight: 800; font-size: .8rem; letter-spacing: 1px; text-transform: uppercase; }

/* ---------- شبكة الإحصاءات ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 14px; }
.stat { background: linear-gradient(160deg, var(--mint), #fff); border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 16px 18px; transition: transform .2s ease, box-shadow .2s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat .num { font-size: 1.95rem; font-weight: 800; color: var(--green-700); line-height: 1.1; }
.stat .lbl { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---------- مخطط الأصوات (أعمدة) ---------- */
.result-q { margin-bottom: 26px; }
.result-q .qtitle { font-weight: 800; margin-bottom: 4px; color: var(--ink); }
.result-q .qmeta { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.bar-row { margin-bottom: 12px; }
.bar-row .bar-head { display: flex; justify-content: space-between; font-size: .9rem; margin-bottom: 6px; font-weight: 600; }
.bar-row .bar-head .pct { color: var(--green-700); font-weight: 800; }
.bar-track { height: 14px; background: #eef2ef; border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-600), var(--green-400));
  transition: width .9s cubic-bezier(.16,.84,.34,1);
}
.bar-row.leading .bar-fill { background: linear-gradient(90deg, var(--green-700), var(--gold)); }

/* ---------- قائمة الحضور ---------- */
.attendance { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.attendee { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.attendee .avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--green-600), var(--green-400)); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.attendee .who { flex: 1; min-width: 0; }
.attendee .who b { display: block; font-size: .95rem; }
.attendee .who small { color: var(--muted); font-size: .76rem; }
.attendee .vcount { font-size: .78rem; color: var(--green-700); font-weight: 700; white-space: nowrap; }

/* ---------- الوسائط داخل السؤال ---------- */
.q-media { border-radius: var(--radius-sm); overflow: hidden; margin: 12px 0 16px; border: 1px solid var(--line); background: #000; }
.q-media img, .q-media video { display: block; width: 100%; max-height: min(340px, 45dvh); object-fit: contain; background: #0b120e; }

/* ---------- خيارات التصويت ---------- */
.options { display: grid; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  border: 1.6px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
  transition: border-color .16s, background .16s, transform .1s;
}
.option:hover { border-color: var(--green-400); background: var(--green-050); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.option.selected { border-color: var(--green-600); background: linear-gradient(180deg, var(--mint), #fff); box-shadow: var(--ring); }
.option .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; transition: border-color .16s; }
.option.selected .radio { border-color: var(--green-600); }
.option.selected .radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--green-600); }
.option .otext { font-weight: 600; flex: 1; }
.option .oside { font-size: .82rem; color: var(--muted); font-weight: 700; }

/* خيارات تحتوي وسائط */
.option .opt-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.option.has-media { align-items: flex-start; }
.option.has-media .radio { margin-top: 4px; }
.opt-media { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0b120e; max-width: 260px; }
.opt-media img, .opt-media video { display: block; width: 100%; max-height: 190px; object-fit: contain; background: #0b120e; }

/* رسالة الشكر */
.thanks-banner { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--green-700), var(--green-500)); color: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; box-shadow: 0 10px 26px rgba(20,138,75,.28); }
.thanks-banner .t-emoji { font-size: 1.9rem; line-height: 1; }
.thanks-banner b { display: block; font-size: 1.05rem; }
.thanks-banner small { opacity: .92; font-size: .85rem; }
.pop-in { animation: pop .45s cubic-bezier(.16,.84,.34,1) both; }

/* منشئ الخيارات — وسائط الخيار */
.opt-builder { margin-bottom: 10px; }
.opt-media-btn { padding: 8px 10px; cursor: pointer; flex: none; }
.opt-media-note:not(:empty) { margin: 4px 0 2px; }
.opt-thumb { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--green-100); border-radius: 8px; padding: 5px 8px; font-size: .8rem; color: var(--green-700); font-weight: 700; }
.opt-thumb img, .opt-thumb video { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: #0b120e; }

/* صور مصغّرة في نتائج المدير */
.opt-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.mini-thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 6px; background: #0b120e; flex: none; }

/* ---------- شبكة الجلسات (المدير) ---------- */
.sessions-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.session-card { display: flex; flex-direction: column; gap: 12px; }
.session-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.session-card h3 { font-size: 1.1rem; color: var(--green-900); }
.session-card .meta { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.session-card .meta b { color: var(--ink); }
.session-card .row { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ---------- إضافة مشرف ---------- */
.add-admin-grid { display: grid; grid-template-columns: 1.3fr 1.3fr .8fr auto; gap: 8px; align-items: center; }
@media (max-width: 620px) { .add-admin-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- منشئ الأسئلة ---------- */
.q-builder { border: 1px dashed var(--green-100); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; background: var(--green-050); }
.q-builder .qb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.q-builder .qb-head .qb-tools { margin-inline-start: auto; }
.q-builder .qb-head b { color: var(--green-900); }
.opt-input-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.opt-input-row input { flex: 1 1 140px; min-width: 0; }

/* ---------- شريط المشاركة ---------- */
.share-box { display: flex; gap: 8px; align-items: center; background: var(--green-050); border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 8px 8px 8px 14px; }
.share-box code { flex: 1; font-size: .85rem; color: var(--green-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; }

/* ---------- تبويبات ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 10px 16px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tab.active { color: var(--green-700); border-color: var(--green-600); }

/* ---------- نافذة منبثقة ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(13,33,26,.5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .2s ease; overflow: auto; }
.modal { --modal-pad: 28px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(720px, 100%); max-width: 100%; max-height: 88dvh; overflow: auto; padding: var(--modal-pad); animation: pop .25s cubic-bezier(.16,.84,.34,1); -webkit-overflow-scrolling: touch; }
/* رأس النافذة يبقى ظاهراً أثناء التمرير ليبقى زر الإغلاق في المتناول دائماً */
.modal-head {
  position: sticky; top: 0; z-index: 2; background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line);
  margin: calc(-1 * var(--modal-pad)) calc(-1 * var(--modal-pad)) 18px;
  padding: 16px var(--modal-pad) 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.modal-head h3 { color: var(--green-900); font-size: 1.25rem; }
.x-btn { border: none; background: #f2f5f3; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 1.1rem; color: var(--muted); flex: none; }
.x-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------- الحركات ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fade .4s ease both; }
.slide-up { animation: slideUp .5s cubic-bezier(.16,.84,.34,1) both; }
.stagger > * { animation: slideUp .5s cubic-bezier(.16,.84,.34,1) both; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .10s; }
.stagger > *:nth-child(3) { animation-delay: .16s; }
.stagger > *:nth-child(4) { animation-delay: .22s; }
.stagger > *:nth-child(5) { animation-delay: .28s; }
.stagger > *:nth-child(6) { animation-delay: .34s; }
.stagger > *:nth-child(7) { animation-delay: .40s; }
.stagger > *:nth-child(8) { animation-delay: .46s; }

/* شاشة البداية للموظف */
.hero-logo { position: relative; display: grid; place-items: center; margin-bottom: 20px; }
.hero-logo::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 197, 131, 0.22), rgba(56, 197, 131, 0.05) 55%, transparent 72%);
  z-index: 0;
}
.hero-logo img { position: relative; z-index: 1; height: 100px; filter: drop-shadow(0 8px 18px rgba(13,90,51,.18)); animation: floaty 4.5s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.hero-title {
  text-align: center; font-size: 1.7rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -.3px;
  background: linear-gradient(120deg, var(--green-800), var(--green-500));
  -webkit-background-clip: text; background-clip: text; color: var(--green-900);
  -webkit-text-fill-color: transparent;
}
.hero-sub { text-align: center; color: var(--muted); margin-bottom: 26px; font-size: 1.02rem; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }

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

.footer-note { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px; }

/* ==========================================================================
   باني الأسئلة المرن + المنطق الشرطي + المسودّات + الهوية البصرية
   ========================================================================== */

/* ---------- غلاف الجلسة (Header Media) ---------- */
.cover-media {
  border-radius: var(--radius); overflow: hidden; margin: 18px 0 18px;
  border: 1px solid var(--line); background: #0b120e; box-shadow: var(--shadow);
}
.cover-media img, .cover-media video { display: block; width: 100%; max-height: min(320px, 40dvh); object-fit: cover; }
.cover-prev { position: relative; margin-top: 10px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: #0b120e; }
.cover-prev img, .cover-prev video { display: block; width: 100%; max-height: 200px; object-fit: cover; }
.cover-prev .btn { position: absolute; top: 8px; inset-inline-end: 8px; }
.card-cover { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: #0b120e; margin-bottom: 4px; }
.card-cover img, .card-cover video { display: block; width: 100%; height: 110px; object-fit: cover; }

/* ---------- بطاقة السؤال عند المشارك ---------- */
.q-card { scroll-margin-top: calc(var(--hdr-h) + 80px); }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.q-num { font-weight: 800; color: var(--green-800); font-size: .85rem; }
.q-type { font-size: .74rem; font-weight: 700; color: var(--muted); background: var(--green-050); border: 1px solid var(--green-100); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.q-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.req-star { color: var(--danger); font-weight: 800; margin-inline-start: 4px; }
.q-missing { animation: shake .45s ease; border-color: var(--danger) !important; box-shadow: 0 0 0 4px rgba(214,69,80,.14) !important; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* مربع اختيار للأسئلة متعددة الاختيار */
.option .checkbox { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; transition: border-color .16s, background .16s; }
.option.selected .checkbox { border-color: var(--green-600); background: var(--green-600); }
.option.selected .checkbox::after { content: "✓"; color: #fff; font-size: .8rem; font-weight: 800; line-height: 1; }

/* قائمة منسدلة كإجابة */
.dropdown-answer { margin-top: 4px; }

/* ---------- مقياس ليكرت ---------- */
.likert { display: grid; gap: 8px; }
.likert-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1.6px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer;
  transition: border-color .16s, background .16s, transform .1s;
}
.likert-item:hover { border-color: var(--green-400); background: var(--green-050); transform: translateY(-1px); }
.likert-item.selected { border-color: var(--green-600); background: linear-gradient(180deg, var(--mint), #fff); box-shadow: var(--ring); }
.likert-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.likert-item.selected .likert-dot { border-color: var(--green-600); }
.likert-item.selected .likert-dot::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green-600); }
.likert-label { flex: 1; font-weight: 600; font-size: .95rem; }
.likert-pct { font-size: .8rem; color: var(--muted); font-weight: 700; }

/* ---------- التقييم بالنجوم/الأرقام ---------- */
.rating-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.rate-side { font-size: .82rem; color: var(--muted); font-weight: 600; }
/* سلالم التقييم الطويلة (حتى 10) تلتفّ بدل أن تمدّ الصفحة على الجوّال */
.rate-items { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.rate-item {
  font-family: inherit; cursor: pointer; border: 1.6px solid var(--line); background: #fff;
  border-radius: 10px; transition: transform .12s, border-color .16s, background .16s, color .16s;
}
.rate-item.star { width: 42px; height: 42px; font-size: 1.4rem; line-height: 1; color: #dfe6e1; border: none; background: transparent; }
.rate-item.star:hover { transform: scale(1.15); }
.rate-item.star.on { color: var(--gold); }
.rate-item.num { min-width: 42px; height: 42px; font-size: 1rem; font-weight: 800; color: var(--muted); }
.rate-item.num:hover { border-color: var(--green-400); }
.rate-item.num.on { background: var(--green-050); border-color: var(--green-400); color: var(--green-800); }
.rate-item.num.exact { background: linear-gradient(135deg, var(--green-700), var(--green-500)); color: #fff; border-color: transparent; }
.rate-value { font-size: .85rem; font-weight: 800; color: var(--green-700); }

/* ---------- الإجابات النصية ---------- */
.text-answer { width: 100%; margin-top: 4px; }
.text-meta { text-align: end; font-size: .76rem; color: var(--muted); margin-top: 4px; }
.pct-note { font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: 8px; }

/* ---------- شريط التقدّم + حالة الحفظ التلقائي ---------- */
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; font-size: .88rem; }
.progress-track { height: 9px; background: #eef2ef; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--green-600), var(--green-400)); transition: width .5s cubic-bezier(.16,.84,.34,1); }
.save-pill { font-size: .76rem; font-weight: 700; padding: 4px 11px; border-radius: 999px; transition: background .2s, color .2s; }
.save-pill.saving { background: #fff6e2; color: #8a6a1f; }
.save-pill.saved { background: var(--green-050); color: var(--green-700); }
.save-pill.offline { background: var(--danger-bg); color: var(--danger); }

/* ---------- المسودّة والتفرّع والإنهاء ---------- */
.draft-note, .restore-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff8e6; border: 1px solid #f0dfb0; border-inline-start: 4px solid var(--gold);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px;
}
.draft-note b, .restore-bar b { display: block; font-size: .95rem; color: #7a5c12; }
.draft-note small, .restore-bar small { color: #8a7133; font-size: .82rem; }
.restore-bar { justify-content: space-between; }
.branch-note { text-align: center; color: var(--muted); font-size: .88rem; padding: 14px; border: 1px dashed var(--green-100); border-radius: var(--radius-sm); background: var(--green-050); margin-bottom: 18px; }
.finish-box { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: linear-gradient(160deg, var(--mint), #fff); border: 1px solid var(--green-100); border-radius: var(--radius); padding: 18px 22px; margin-top: 6px; }
.finish-msg b { display: block; color: var(--green-900); }
.finish-msg small { color: var(--muted); font-size: .84rem; }

/* ---------- باني الأسئلة (لوحة المدير) ---------- */
.builder-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.btab { padding: 9px 15px; cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.btab.active { color: var(--green-700); border-color: var(--green-600); }
.add-q-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.add-q-row .btn { font-size: .8rem; }
.qb-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.type-select, .goto-select, .role-select { font-family: inherit; font-size: .82rem; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; width: auto; }
.q-flags { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 600; cursor: pointer; }
.chk input { width: 17px; height: 17px; }
.q-settings { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; background: #fff; border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.q-settings label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 700; color: var(--muted); flex: 1; min-width: 120px; }
.q-settings input, .q-settings select { font-family: inherit; font-size: .9rem; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; width: 100%; }
.opts-title { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 7px; }
.opts-title small { color: var(--muted); font-weight: 400; }
.likert-presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }

/* المنطق الشرطي */
.logic-box { margin-top: 14px; background: #fff; border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 10px 14px; }
.logic-box summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--green-800); display: flex; align-items: center; gap: 8px; }
.logic-box[open] summary { margin-bottom: 10px; }
.logic-rules { display: grid; gap: 8px; margin-bottom: 10px; }
.logic-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 0; border-top: 1px solid var(--line); }
.logic-row:first-child { border-top: none; }
.logic-when { font-size: .85rem; color: var(--muted); flex: 1; min-width: 150px; }
.logic-when b { color: var(--ink); }

/* الهوية البصرية */
.accent-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.accent-row input[type=color] { width: 56px; height: 40px; padding: 2px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.accent-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .12s, border-color .16s; }
.swatch:hover { transform: translateY(-2px); }
.swatch.on { border-color: var(--ink); }

.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; margin-top: 6px; }
.check-row input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.check-row b { display: block; font-size: .92rem; }
.check-row small { color: var(--muted); font-size: .82rem; }
.check-row.disabled { opacity: .55; }

.builder-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- الصلاحيات ---------- */
.roles-legend { display: grid; gap: 8px; background: var(--green-050); border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; }
.roles-legend b { font-size: .9rem; color: var(--green-900); }
.roles-legend small { display: block; color: var(--muted); font-size: .82rem; }

/* ---------- نتائج الأنواع الجديدة ---------- */
.rating-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.rate-avg { display: flex; align-items: baseline; gap: 5px; }
.rate-avg b { font-size: 2rem; font-weight: 800; color: var(--green-700); line-height: 1; }
.rate-avg small { color: var(--muted); font-size: .82rem; }
.rate-bar { flex: 1; min-width: 140px; height: 12px; background: #eef2ef; border-radius: 999px; overflow: hidden; }
.rate-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green-600), var(--gold)); transition: width .9s cubic-bezier(.16,.84,.34,1); }
.text-answers { display: grid; gap: 8px; max-height: 340px; overflow: auto; }
.text-answer-item { background: var(--green-050); border: 1px solid var(--green-100); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; line-height: 1.65; }
.result-q .qtitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.answer-row { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--line); }
.answer-num { color: var(--muted); font-size: .85rem; min-width: 20px; }
.answer-q { flex: 1; font-size: .9rem; }
.answer-val { white-space: normal; text-align: start; max-width: 55%; }
.answer-time { font-size: .72rem; font-weight: 700; color: var(--muted); background: #f2f5f3; border-radius: 999px; padding: 2px 8px; white-space: nowrap; flex: none; }

/* ==========================================================================
   تحسينات سهولة الاستخدام
   ========================================================================== */

/* ---------- أدوات قائمة الاستبيانات ---------- */
.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.list-tools input[type=search] { flex: 1; min-width: 200px; font-family: inherit; font-size: .95rem; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.chip-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: inherit; font-size: .84rem; font-weight: 700; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; transition: background .16s, color .16s, border-color .16s; }
.chip:hover { border-color: var(--green-400); }
.chip.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* ---------- أزرار أيقونية مضغوطة ---------- */
.icon-btn { font-family: inherit; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1; display: inline-grid; place-items: center; transition: background .15s, color .15s, border-color .15s; }
.icon-btn:hover { border-color: var(--green-400); background: var(--green-050); color: var(--green-800); }
.icon-btn.danger:hover { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

/* ---------- القوالب الجاهزة ---------- */
.tpl-box { background: linear-gradient(160deg, var(--mint), #fff); border: 1px solid var(--green-100); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.tpl-head { margin-bottom: 12px; }
.tpl-head b { color: var(--green-900); font-size: 1rem; }
.tpl-head small { display: block; color: var(--muted); font-size: .82rem; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px; margin-bottom: 12px; }
.tpl-card { font-family: inherit; text-align: start; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; transition: transform .14s, border-color .16s, box-shadow .2s; }
.tpl-card:hover { transform: translateY(-3px); border-color: var(--green-400); box-shadow: var(--shadow-sm); }
.tpl-icon { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.tpl-card b { display: block; font-size: .92rem; color: var(--green-900); margin-bottom: 3px; }
.tpl-card small { color: var(--muted); font-size: .78rem; line-height: 1.5; }

/* ---------- بطاقة السؤال في الباني (قابلة للطيّ) ---------- */
.q-builder .qb-head { cursor: pointer; user-select: none; gap: 8px; }
.q-builder.has-issue { border-color: var(--danger); background: #fff8f8; }
.qb-caret { color: var(--muted); font-size: .8rem; width: 14px; flex: none; }
.qb-title { flex: 1; font-weight: 700; font-size: .92rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 60px; }
.q-builder.folded { background: #fff; }
.q-builder.folded .qb-head { margin-bottom: 0; }
.badge-issue { background: var(--danger-bg); color: var(--danger); }
.qb-body { padding-top: 4px; }
.add-q-label { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 16px 0 8px; }
.opt-index { width: 22px; flex: none; text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); align-self: center; }
.opts-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.media-box { margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.media-box summary { cursor: pointer; font-weight: 700; font-size: .86rem; color: var(--green-800); }
.media-box[open] summary { margin-bottom: 10px; }
.media-box input[type=file] { font-size: .85rem; }
.logic-alert { border-inline-start: 4px solid var(--danger); }
.logic-warn { background: #fff8e6; border: 1px solid #f0dfb0; border-inline-start: 3px solid var(--gold); border-radius: 9px; padding: 9px 12px; font-size: .84rem; color: #7a5c12; margin: 8px 0; line-height: 1.6; }

/* ---------- لوحة التحليلات ---------- */
.stat-hint { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.ana-section { margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ana-section:last-of-type { border-bottom: none; }
.ana-title { font-weight: 800; color: var(--green-900); font-size: 1.02rem; margin-bottom: 6px; }
.drop-badge { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--danger); background: var(--danger-bg); padding: 2px 7px; border-radius: 999px; margin-inline-start: 6px; }
.timeline { display: flex; gap: 6px; align-items: flex-end; overflow-x: auto; padding: 8px 2px 0; }
.tl-col { flex: 1; min-width: 34px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tl-bar-wrap { height: 110px; width: 100%; display: flex; align-items: flex-end; }
.tl-bar { width: 100%; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, var(--green-500), var(--green-700)); transition: height .6s cubic-bezier(.16,.84,.34,1); min-height: 4px; }
.tl-n { font-size: .82rem; font-weight: 800; color: var(--green-700); }
.tl-label { font-size: .68rem; color: var(--muted); white-space: nowrap; text-align: center; }

/* ---------- المعاينة ---------- */
.preview-frame { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-height: 60dvh; overflow: auto; }
.preview-frame .option, .preview-frame .likert-item, .preview-frame .rate-item { cursor: default; pointer-events: none; }
.preview-title { color: var(--green-900); font-size: 1.2rem; margin-bottom: 4px; }
.preview-desc { color: var(--muted); font-size: .9rem; margin-bottom: 16px; }

/* ---------- تقدّم الموظف (لاصق) ---------- */
.progress-wrap { position: sticky; top: var(--hdr-h); z-index: 20; margin-bottom: 16px; padding: 13px 18px;
  background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(10px); box-shadow: var(--shadow-sm); }
.q-error { margin-top: 12px; background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 9px 13px; font-size: .86rem; font-weight: 700; }

/* ==========================================================================
   التجاوب مع الشاشات — من جوّال 320px إلى شاشات 4K
   المنهج: تخطيط مرن أولاً (flex/grid + min()) ثم نقاط توقّف للتفاصيل.
   ========================================================================== */

/* ---------- شاشات كبيرة جداً: نوسّع عمود المحتوى بدل تركه شريطاً ضيّقاً ---------- */
@media (min-width: 1600px) {
  :root { --maxw: 1320px; --gutter: 28px; }
}
@media (min-width: 2000px) {
  :root { --maxw: 1520px; --gutter: 32px; }
  .sessions-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
}

/* ---------- لوحي / شاشة صغيرة ---------- */
@media (max-width: 1024px) {
  :root { --gutter: 18px; }
  .card.pad-lg { padding: 28px; }
  .modal { --modal-pad: 24px; }
}

/* ---------- جوّال كبير ولوحي رأسي ---------- */
@media (max-width: 760px) {
  :root { --gutter: 15px; }
  .brand img { height: 44px; }
  .brand .titles b { font-size: .98rem; }
  .brand .titles span { font-size: .72rem; }
  .card { padding: 20px; }
  .card.pad-lg { padding: 24px 20px; }
  .container { padding: 20px var(--gutter) 50px; }
  .stat .num { font-size: 1.6rem; }
  .stat { padding: 14px 15px; }

  /* النوافذ المنبثقة تتحوّل إلى «ورقة» تملأ الشاشة */
  .modal-overlay { padding: 0; place-items: end center; }
  .modal {
    --modal-pad: 16px;
    width: 100%; max-width: 100%; max-height: 96dvh;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: calc(var(--modal-pad) + env(safe-area-inset-bottom));
  }
  .modal-head { margin-bottom: 14px; }
  .modal-head h3 { font-size: 1.08rem; }

  /* التبويبات تُمرَّر أفقياً داخل شريطها بدل كسر التخطيط */
  .tabs, .builder-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  .tabs::-webkit-scrollbar, .builder-tabs::-webkit-scrollbar { display: none; }
  .tab, .btab { flex: none; scroll-snap-align: start; }

  .finish-box { flex-direction: column; align-items: stretch; padding: 16px; }
  .finish-box .btn { width: 100%; }
  .q-settings label { min-width: 100%; }
  .answer-val { max-width: 100%; }
  .qb-title { white-space: normal; flex: 1 1 100%; }
  .q-builder .qb-head .qb-tools { margin-inline-start: 0; width: 100%; }
  .option, .likert-item { padding: 14px; }
  .attendance { max-height: min(420px, 60dvh); }
  .text-answers { max-height: min(340px, 55dvh); }
  .opt-media { max-width: 100%; }
  .hero-title { font-size: 1.45rem; }
  .hero-logo img { height: 82px; }
  .hero-logo::before { width: 165px; height: 165px; }
  .thanks-banner { padding: 14px 16px; }
  .share-box { padding: 8px; }
  .list-tools input[type=search] { min-width: 100%; }
}

/* ---------- جوّالات معتادة ---------- */
@media (max-width: 640px) {
  .brand .titles span { display: none; }
  .section-title h2 { font-size: 1.18rem; }
  .section-title > .btn, .section-title > button { width: 100%; }
  .rate-item.star { width: 38px; height: 38px; font-size: 1.25rem; }
  .rate-item.num { min-width: 40px; height: 40px; }
  .result-q { margin-bottom: 20px; }
  .empty { padding: 36px 14px; }
}

/* ---------- جوّالات صغيرة ---------- */
@media (max-width: 430px) {
  .add-admin-grid { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; border-radius: 16px; }
  .card.pad-lg { padding: 20px 16px; }
  .stats { gap: 10px; }
  .stat { padding: 12px 13px; }
  .q-builder { padding: 12px; }
  .add-q-row .btn { flex: 1 1 46%; }
  .header-actions .btn { flex: 1 1 auto; }
  .attendee { gap: 9px; padding: 9px 10px; }
  .attendee .avatar { width: 34px; height: 34px; }
  .hero-title { font-size: 1.3rem; }
  .hero-sub { font-size: .95rem; margin-bottom: 20px; }
  .thanks-banner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .q-text { font-size: 1.02rem; }
}

/* ---------- جوّال بالوضع الأفقي (ارتفاع ضيّق) ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  .center-screen { min-height: auto; padding: 18px; }
  .hero-logo { margin-bottom: 10px; }
  .hero-logo img { height: 60px; }
  .hero-logo::before { display: none; }
  .hero-title { font-size: 1.25rem; }
  .hero-sub { margin-bottom: 16px; }
  .modal { max-height: 94dvh; }
  .site-header { position: static; }
  .progress-wrap { position: static; }
}

/* ---------- أجهزة اللمس: أهداف أكبر وحقول بلا تكبير تلقائي ---------- */
@media (pointer: coarse) {
  .btn { min-height: var(--tap); }
  .btn-sm { min-height: 40px; padding: 9px 14px; }
  .icon-btn { width: 40px; height: 40px; font-size: 1rem; }
  .x-btn { width: 42px; height: 42px; }
  .chip { padding: 10px 16px; min-height: 40px; }
  .tab, .btab { padding: 12px 16px; }
  .swatch { width: 40px; height: 40px; }
  .chk input, .check-row input { width: 22px; height: 22px; }
  .rate-item.star { width: var(--tap); height: var(--tap); }
  .rate-item.num { min-width: var(--tap); height: var(--tap); }
  /* iOS يكبّر الصفحة تلقائياً عند التركيز على حقل خطّه أصغر من 16px.
     نكرّر المحدّدات بنفس أوزان القواعد الأصلية كي تسبقها فعلاً. */
  input, input[type], select, textarea,
  .type-select, .goto-select, .role-select,
  .q-settings input, .q-settings select,
  .media-box input[type=file],
  .list-tools input[type=search] { font-size: 16px; }
  input[type], select, textarea,
  .type-select, .goto-select, .role-select,
  .q-settings input, .q-settings select { min-height: var(--tap); }
  input[type=checkbox], input[type=radio], input[type=color], input[type=file] { min-height: 0; }
  .option:hover, .likert-item:hover, .stat:hover, .tpl-card:hover,
  .session-card:hover, .btn-primary:hover, .swatch:hover { transform: none; }
}

/* ---------- تفضيل تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
