/* =====================================================
   القائمة بثلاثة أشكال يختارها صاحب اللوحة من الإعدادات
     nav-side   : عمود جانبي محدد بإطار ومجموعات (الافتراضي)
     nav-top    : شريط أفقي تحت الشريط العلوي
     nav-bubble : زر عائم يفتح القائمة فوقه
   + جولة التعريف + أزرار بزوايا ناعمة (لا شكل كبسولي)
   ===================================================== */
:root { --tb: 58px; }

/* ---------- عناصر مشتركة ---------- */
body .sidenav .nav-group { display: grid; gap: 2px; }
body .sidenav .nav-group + .nav-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
body .sidenav .nav-group-title {
  display: block; padding: 2px 12px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--ink-soft); opacity: .8;
}
body .sidenav a {
  position: relative; display: flex !important; align-items: center; gap: 10px;
  padding: 7px 12px !important; margin: 0 !important; border-radius: 10px !important;
  font-size: 14px !important; line-height: 1.35; transform: none !important;
}
body .sidenav a .nav-label { flex: 1; min-width: 0; }
body .sidenav a .nav-icon { display: inline-grid; place-items: center; width: 20px; flex: none; }
body .sidenav a .nav-icon .ic { width: 18px; height: 18px; }
body .sidenav a.active { background: color-mix(in srgb, var(--rose) 13%, transparent) !important; color: var(--rose-deep) !important; font-weight: 600 !important; box-shadow: none !important; }
body .sidenav a.active::before {
  content: ''; position: absolute; inset-block: 8px; inset-inline-start: 0; width: 3px; border-radius: 3px; background: var(--rose);
}
[data-theme="dark"] body .sidenav a.active, body[data-theme="dark"] .sidenav a.active { color: var(--ink) !important; }
body .sidenav .badge { animation: none; border-radius: 6px; font-size: 11px; padding: 1px 6px; margin: 0; }
.nav-scrim { display: none; }
.nav-bubble-btn { display: none; }

/* ---------- 1) جانبية (شاشة كبيرة) ---------- */
@media (min-width: 821px) {
  body.nav-side .shell { align-items: flex-start; }
  body.nav-side .sidenav {
    position: sticky; top: calc(var(--tb) + 14px); align-self: flex-start;
    width: 244px !important; margin: 14px; margin-inline-end: 0;
    max-height: calc(100vh - var(--tb) - 28px); overflow-y: auto; overscroll-behavior: contain;
    padding: 10px !important;
    background: var(--card) !important; border: 1px solid var(--line) !important; border-radius: 16px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04) !important;
    scrollbar-width: thin;
  }
}
@media (min-width: 901px) {
  html.nav-hidden body.nav-side .sidenav { width: 0 !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
}

/* ---------- 2) علوية ---------- */
@media (min-width: 821px) {
  body.nav-top .shell { display: block; }
  body.nav-top .sidenav {
    position: sticky; top: var(--tb); z-index: 45; width: auto !important; max-height: none;
    display: flex; align-items: center; gap: 4px; overflow: hidden;
    margin: 0; padding: 6px 16px !important; opacity: 1 !important; pointer-events: auto !important;
    background: color-mix(in srgb, var(--card) 94%, transparent) !important;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important;
  }
  body.nav-top .nav-track { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  body.nav-top .nav-track::-webkit-scrollbar { display: none; }
  body.nav-top .sidenav .nav-group { display: flex; gap: 2px; margin: 0; padding: 0; border: 0; flex: none; }
  body.nav-top .sidenav .nav-group + .nav-group { margin: 0; padding: 0; padding-inline-start: 6px; border-top: 0; border-inline-start: 1px solid var(--line); }
  body.nav-top .sidenav .nav-group-title { display: none; }
  body.nav-top .sidenav a { white-space: nowrap; padding: 7px 10px !important; font-size: 13.5px !important; }
  body.nav-top .sidenav a.active::before { inset-block: auto 0; inset-inline: 10px; width: auto; height: 2px; }
  body.nav-top .content { margin-inline: auto; }
}

/* ---------- 3) فقاعة (كل الشاشات) ---------- */
body.nav-bubble .shell { display: block; }
body.nav-bubble .content { margin-inline: auto; }
body.nav-bubble .menu-btn, body.nav-bubble .nav-toggle { display: none !important; }
body.nav-bubble .nav-bubble-btn {
  position: fixed; inset-inline-start: 20px; bottom: 20px; z-index: 610;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--ink); color: var(--card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}
body.nav-bubble .nav-bubble-btn .ic { width: 22px; height: 22px; }
body.nav-bubble .nav-bubble-btn .nb-close { display: none; }
body.nav-bubble.nav-open .nav-bubble-btn .nb-open { display: none; }
body.nav-bubble.nav-open .nav-bubble-btn .nb-close { display: grid; }
body.nav-bubble .sidenav {
  position: fixed !important; z-index: 605; inset-inline-start: 20px; inset-block: auto 88px !important; top: auto !important;
  width: min(360px, calc(100vw - 40px)) !important; max-height: min(70vh, 560px); overflow-y: auto;
  margin: 0 !important; padding: 12px !important; opacity: 0 !important; visibility: hidden; pointer-events: none !important;
  transform: translateY(8px) !important; transition: opacity .18s, transform .18s, visibility 0s .18s !important;
  background: var(--card) !important; border: 1px solid var(--line) !important; border-radius: 16px !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22) !important;
}
body.nav-bubble.nav-open .sidenav { opacity: 1 !important; visibility: visible; pointer-events: auto !important; transform: none !important; transition: opacity .18s, transform .18s !important; }
body.nav-bubble .sidenav .nav-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.nav-bubble .sidenav .nav-group-title { grid-column: 1 / -1; }
body.nav-bubble.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 600; background: rgba(15, 10, 14, .18); }
html.nav-hidden body.nav-bubble .sidenav { width: min(360px, calc(100vw - 40px)) !important; }

/* ---------- الجوال: الجانبية والعلوية تصير درجًا ---------- */
@media (max-width: 820px) {
  body.nav-side .sidenav, body.nav-top .sidenav {
    position: fixed !important; inset-block: var(--tb) 0; inset-inline-start: 0; z-index: 605;
    width: min(290px, 86vw) !important; overflow-y: auto; padding: 12px !important;
    background: var(--card) !important; border-inline-end: 1px solid var(--line) !important; border-radius: 0 !important;
  }
  body.nav-open.nav-side .nav-scrim, body.nav-open.nav-top .nav-scrim { display: block; position: fixed; inset: var(--tb) 0 0; z-index: 600; background: rgba(15, 10, 14, .35); }
  body.nav-bubble .nav-bubble-btn { inset-inline-start: 16px; bottom: 16px; }
  body.nav-bubble .sidenav { inset-inline-start: 12px; inset-block: auto 84px !important; width: calc(100vw - 24px) !important; }
}

/* ---------- الأزرار: زوايا ناعمة بدل الكبسولة ---------- */
.btn, .kz-btn, .kb-btn, .kc-act, .tab, .kx-start-btn { border-radius: 10px !important; }

/* =====================================================
   جولة التعريف
   ===================================================== */
.kz-tour { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
.kz-tour-block { position: fixed; inset: 0; pointer-events: auto; background: transparent; }
.kz-tour-block.dim { background: rgba(15, 10, 14, .5); }
.kz-tour-spot {
  position: fixed; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(15, 10, 14, .5), 0 0 0 2px var(--rose);
  transition: top .28s ease, left .28s ease, width .28s ease, height .28s ease;
}
.kz-tour-card {
  position: fixed; width: min(340px, calc(100vw - 32px)); pointer-events: auto;
  /* زجاجي: شفاف مع ضباب خلفه وحافة لامعة */
  background: linear-gradient(150deg, color-mix(in srgb, var(--card) 72%, transparent), color-mix(in srgb, var(--card) 48%, transparent));
  -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
  color: var(--ink); border: 1px solid rgba(255, 255, 255, .38); border-radius: 18px;
  padding: 18px 18px 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 0 1px color-mix(in srgb, var(--rose) 14%, transparent);
  transition: top .28s ease, left .28s ease;
}
[data-theme="dark"] .kz-tour-card { border-color: rgba(255, 255, 255, .16); box-shadow: 0 24px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12); }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) { .kz-tour-card { background: var(--card); } }
.kz-tour-card p { color: color-mix(in srgb, var(--ink) 78%, transparent) !important; }
.kz-tour-card:focus { outline: none; }
.kz-tour-step { font-size: 12px; color: var(--ink-soft); margin: 0 0 6px; }
.kz-tour-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.kz-tour-card p { margin: 0 0 14px; font-size: 14px; line-height: 1.75; color: var(--ink-soft); }
.kz-tour-dots { display: flex; gap: 5px; margin: 0 0 12px; }
.kz-tour-dots i { width: 16px; height: 3px; border-radius: 2px; background: var(--line); }
.kz-tour-dots i.on { background: var(--rose); }
.kz-tour-acts { display: flex; align-items: center; gap: 8px; }
.kz-tour-acts .grow { flex: 1; }
.kz-tour-acts button { font: inherit; font-size: 13.5px; cursor: pointer; border-radius: 9px; padding: 8px 14px; }
.kz-tour-next { background: var(--ink); color: var(--card); border: 0; font-weight: 600; }
.kz-tour-prev { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.kz-tour-skip { background: none; border: 0; color: var(--ink-soft); padding-inline: 4px !important; text-decoration: underline; text-underline-offset: 3px; }
/* السهم: يشير من البطاقة إلى العنصر */
.kz-tour-arrow { position: fixed; width: 34px; height: 34px; pointer-events: none; color: var(--rose); transition: top .28s ease, left .28s ease; }
.kz-tour-arrow svg { width: 100%; height: 100%; display: block; }
@media (prefers-reduced-motion: reduce) {
  .kz-tour-spot, .kz-tour-card, .kz-tour-arrow, body.nav-bubble .sidenav { transition: none !important; }
}

/* =====================================================
   الإعدادات والدعم
   ===================================================== */
.set-tabs { margin-bottom: 18px; }
.set-h { font-size: 16px !important; font-weight: 700 !important; color: var(--ink) !important; margin: 0 0 6px !important; }
.card .set-h + .set-note, .set-note { margin: 0 0 14px; font-size: 13.5px; }
.card .set-h:not(:first-child) { margin-top: 22px !important; }
.set-l { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.set-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* اختيار شكل القائمة: ثلاث بطاقات بمعاينة صغيرة */
.nav-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.np-o { position: relative; cursor: pointer; display: block; }
.np-o input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.np-card { display: grid; gap: 4px; height: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); transition: border-color .2s; }
.np-card b { font-size: 14px; color: var(--ink); }
.np-card small { font-size: 12px; color: var(--ink-soft); line-height: 1.6; }
.np-o input:checked + .np-card { border-color: var(--rose); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 18%, transparent); }
.np-o input:focus-visible + .np-card { outline: 2px solid var(--rose); outline-offset: 2px; }
.np-prev { position: relative; display: block; height: 74px; margin-bottom: 6px; border-radius: 8px; background: var(--card-soft); border: 1px solid var(--line); overflow: hidden; }
.np-prev i { position: absolute; display: block; background: color-mix(in srgb, var(--rose) 30%, transparent); border-radius: 3px; }
.np-prev .np-bar { inset-inline: 0; top: 0; height: 10px; border-radius: 0; background: color-mix(in srgb, var(--ink) 18%, transparent); }
.np-prev .np-body { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.np-side .np-nav { top: 16px; bottom: 8px; inset-inline-start: 6px; width: 24%; }
.np-side .np-body { top: 16px; bottom: 8px; inset-inline-end: 6px; width: 62%; }
.np-top .np-nav { top: 14px; height: 8px; inset-inline: 6px; }
.np-top .np-body { top: 28px; bottom: 8px; inset-inline: 6px; }
.np-bubble .np-body { top: 16px; bottom: 8px; inset-inline: 6px; }
.np-bubble .np-nav { width: 16px; height: 16px; border-radius: 50%; bottom: 6px; inset-inline-start: 6px; background: var(--ink); }
@media (max-width: 640px) { .nav-pick { grid-template-columns: 1fr; } .np-card { grid-template-columns: 92px 1fr; align-items: center; column-gap: 12px; } .np-prev { grid-row: span 2; margin: 0; height: 58px; } }

.choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-width: min(280px, 100%); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: block; text-align: center; padding: 9px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); font-weight: 500; }
.choice input:checked + span { border-color: var(--rose); background: color-mix(in srgb, var(--rose) 10%, transparent); color: var(--rose-deep); }
.choice input:focus-visible + span { outline: 2px solid var(--rose); outline-offset: 2px; }

.svc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.svc-state { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.svc-state.on { background: var(--good-bg); color: var(--good); }
.svc-state.off { background: var(--card-soft); color: var(--ink-soft); border: 1px solid var(--line); }

.sup-lead { color: var(--ink-soft); margin: -4px 0 16px; }
.sup-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sup-way { display: grid; gap: 3px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-decoration: none; color: var(--ink); transition: border-color .2s; }
.sup-way:hover { border-color: var(--rose); }
.sup-way b { font-size: 15px; }
.sup-way small { color: var(--ink-soft); font-size: 12.5px; overflow-wrap: anywhere; }
.sup-ic { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; margin-bottom: 6px; background: color-mix(in srgb, var(--rose) 12%, transparent); color: var(--rose-deep); }
.sup-ic .ic { width: 18px; height: 18px; }
.sup-custom p { line-height: 1.85; }

/* =====================================================
   الوضع النهاري: أسطح دافئة مصبوغة بلون الهوية بدل الأبيض الصافي
   كل الألوان مشتقة من --rose و --gold، فتتبع لون القالب أو اللون اللي يختاره العميل.
   ===================================================== */
html:not([data-theme="dark"]) {
  --bg: color-mix(in srgb, var(--rose) 9%, #f3eee8);
  --bg-grad:
    radial-gradient(1100px 560px at 88% -12%, color-mix(in srgb, var(--rose) 17%, transparent) 0%, transparent 62%),
    radial-gradient(900px 460px at -8% 108%, color-mix(in srgb, var(--gold) 15%, transparent) 0%, transparent 58%);
  --card: color-mix(in srgb, var(--rose) 3%, #fffcf9);
  --card-soft: color-mix(in srgb, var(--rose) 8%, #f7f2ec);
  --line: color-mix(in srgb, var(--rose) 20%, #e4dcd3);
  --ink: color-mix(in srgb, var(--rose) 16%, #211a1f);
  --ink-soft: color-mix(in srgb, var(--rose) 22%, #5f565b);
  --rose-soft: color-mix(in srgb, var(--rose) 15%, #fffcf9);
  --gold-soft: color-mix(in srgb, var(--gold) 18%, #fffcf9);
}
html:not([data-theme="dark"]) body { background-attachment: fixed; }
html:not([data-theme="dark"]) .card { border-color: color-mix(in srgb, var(--line) 85%, transparent) !important;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--rose) 8%, transparent), 0 8px 24px -10px color-mix(in srgb, var(--rose) 22%, transparent) !important; }
html:not([data-theme="dark"]) .topbar { background: color-mix(in srgb, var(--card) 80%, transparent) !important; }
html:not([data-theme="dark"]) .tbl tbody tr:hover { background: color-mix(in srgb, var(--rose) 6%, transparent) !important; }


/* =====================================================
   رأس القائمة وزر إخفائها بجانبها، وأسهم الشريط العلوي، وزر الإظهار
   ===================================================== */
.nav-head, .nav-arrow, .nav-reveal { display: none; }
.nav-hide, .nav-arrow, .nav-reveal {
  font: inherit; cursor: pointer; color: var(--ink-soft); background: var(--card-soft);
  border: 1px solid var(--line); border-radius: 9px; transition: color .2s, border-color .2s, background .2s;
}
.nav-hide:hover, .nav-arrow:hover, .nav-reveal:hover { color: var(--rose-deep); border-color: color-mix(in srgb, var(--rose) 45%, var(--line)); }
.nav-hide:focus-visible, .nav-arrow:focus-visible, .nav-reveal:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }
.nav-hide .ic, .nav-arrow .ic, .nav-reveal .ic { width: 16px; height: 16px; }
/* السهم «التالي» يشير لنهاية السطر، و«السابق» لبدايته */
[dir="rtl"] .nav-prev .ic, [dir="ltr"] .nav-next .ic { transform: scaleX(-1); }

@media (min-width: 901px) {
  /* جانبية: العنوان وزر الإخفاء أعلى القائمة */
  body.nav-side .nav-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 8px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
  [dir="ltr"] body.nav-side .nav-head { padding: 2px 8px 8px 4px; }
  body.nav-side .nav-head-t { font-size: 12px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
  .nav-hide { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; }
  /* علوية: زر الإخفاء في نهاية الشريط، والعنوان مخفي */
  body.nav-top .nav-head { display: flex; order: 4; flex: none; padding-inline-start: 6px; border-inline-start: 1px solid var(--line); }
  body.nav-top .nav-head-t { display: none; }
  body.nav-top .nav-prev { order: 1; } body.nav-top .nav-track { order: 2; } body.nav-top .nav-next { order: 3; }
  body.nav-top .nav-arrow:not([hidden]) { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; }
  /* بعد الإخفاء: زر صغير في مكان القائمة يرجعها */
  html.nav-hidden body.nav-top .sidenav { display: none !important; }
  html.nav-hidden body.nav-side .nav-reveal, html.nav-hidden body.nav-top .nav-reveal {
    display: inline-flex; align-items: center; gap: 6px; z-index: 44; flex: none;
    padding: 8px 12px; font-size: 13px; font-weight: 600; white-space: nowrap;
    color: var(--ink); background: var(--card); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--rose) 45%, transparent);
  }
  /* جانبية: يأخذ مكان القائمة كعمود صغير، فلا يغطي المحتوى */
  html.nav-hidden body.nav-side .nav-reveal { position: sticky; top: calc(var(--tb) + 14px); align-self: flex-start; margin: 14px; margin-inline-end: 0; }
  /* علوية: يأخذ مكان الشريط تحت الشعار */
  html.nav-hidden body.nav-top .nav-reveal { position: sticky; top: calc(var(--tb) + 8px); margin: 10px 16px 0; }
}

/* حجم الخط ونوعه في الإعدادات */
.size-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 16px; }
.font-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0 18px; }
.sz-o, .ft-o { position: relative; display: block; cursor: pointer; }
.sz-o input, .ft-o input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sz-o span, .ft-o span { display: grid; gap: 2px; justify-items: center; text-align: center; height: 100%; padding: 10px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); transition: border-color .2s; }
.sz-o b { line-height: 1.3; color: var(--ink); }
.ft-o b { font-size: 16px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sz-o small, .ft-o small { font-size: 11.5px; color: var(--ink-soft); font-family: inherit; }
.sz-o input:checked + span, .ft-o input:checked + span { border-color: var(--rose); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rose) 18%, transparent); }
.sz-o input:focus-visible + span, .ft-o input:focus-visible + span { outline: 2px solid var(--rose); outline-offset: 2px; }
@media (max-width: 520px) { .size-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
