/* ───────── ثيم توكي 🎐 — نظام ألوان ديناميكي + وضع ليلي ───────── */
:root {
  --ink: #1f2b45;
  --ink2: #4a5a7d;
  --cloud: #f8fcff;
  --card: rgba(250, 253, 255, .94);
  --sky: #d9ebf8;
  --mint: #8fe3cf;
  --mint-d: #2c9a83;
  --lav: #d3ccf7;
  --peach: #ffdccb;
  --butter: #fbeeb4;
  --rose: #f8cfe0;
  --ok: #278d63;
  --bad: #cf4a4a;
  --line: rgba(38, 50, 77, .14);
  --edge: 2px solid var(--ink);
  --lift: 0 4px 0 rgba(38, 50, 77, .2);
  --bg-img: url("https://i.ibb.co/Mxr96ZJ1/image-1793585700041.jpg");
  --bg-dim: 0;
  --brightness: 1;
  --page-bg: #cfe3f2;
}

/* الوضع الليلي (الافتراضي) */
[data-theme="dark"] {
  --ink: #e8eef8;
  --ink2: #a8b5cc;
  --cloud: #141c2b;
  --card: rgba(24, 32, 48, .95);
  --sky: #1e2a3e;
  --mint: #4fd1b0;
  --mint-d: #3fb89f;
  --lav: #8b80d9;
  --peach: #d89978;
  --butter: #d4c078;
  --rose: #d488a6;
  --ok: #5cd9a8;
  --bad: #f47a7a;
  --line: rgba(232, 238, 248, .16);
  --lift: 0 4px 0 rgba(0, 0, 0, .5);
  --bg-dim: .48;
  --page-bg: #070c15;
}

/* ── الخلفيات ── */
[data-bg="cartoon"] { --bg-img: url("https://i.ibb.co/Mxr96ZJ1/image-1793585700041.jpg"); }
[data-bg="space"]   { --bg-img: url("https://images.unsplash.com/photo-1462331940025-496dfbfc7564?w=1200&auto=format&q=70"); }
[data-bg="stars"]   { --bg-img: url("https://images.unsplash.com/photo-1419242902214-272b3f66ee7a?w=1200&auto=format&q=70"); }
[data-bg="clouds"]  { --bg-img: url("https://images.unsplash.com/photo-1513002749550-c59d786b8e6c?w=1200&auto=format&q=70"); }
[data-bg="nature"]  { --bg-img: url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=1200&auto=format&q=70"); }
[data-bg="plain"]   { --bg-img: none; }

/* ── ألوان التمييز ── */
[data-accent="mint"]     { --mint: #8fe3cf; --mint-d: #2c9a83; }
[data-accent="lavender"] { --mint: #c9c2f5; --mint-d: #7a6ec4; }
[data-accent="peach"]    { --mint: #ffd1b5; --mint-d: #d97e52; }
[data-accent="rose"]     { --mint: #f7c4d8; --mint-d: #c46c91; }
[data-accent="butter"]   { --mint: #f9e6a3; --mint-d: #bf9d3a; }
[data-accent="sky"]      { --mint: #b8dcf5; --mint-d: #4d8fb4; }
[data-theme="dark"][data-accent="mint"]     { --mint: #4fd1b0; --mint-d: #3fb89f; }
[data-theme="dark"][data-accent="lavender"] { --mint: #a99af0; --mint-d: #9186d8; }
[data-theme="dark"][data-accent="peach"]    { --mint: #f0a97d; --mint-d: #d98858; }
[data-theme="dark"][data-accent="rose"]     { --mint: #ec9bb6; --mint-d: #d27a98; }
[data-theme="dark"][data-accent="butter"]   { --mint: #e8d170; --mint-d: #c2a544; }
[data-theme="dark"][data-accent="sky"]      { --mint: #86bfe6; --mint-d: #5c9cca; }

/* ── الأساس ── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Baloo Bhaijaan 2", "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-weight: 500; color: var(--ink); background: var(--page-bg);
  line-height: 1.7;
  padding: max(14px, env(safe-area-inset-top)) 14px max(30px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  filter: brightness(var(--brightness));
  background:
    linear-gradient(180deg, rgba(0,0,0,var(--bg-dim)), rgba(0,0,0,var(--bg-dim))),
    var(--bg-img) center / cover no-repeat,
    linear-gradient(180deg, var(--page-bg), var(--page-bg));
  transition: filter .3s;
}
.wrap { max-width: 480px; margin: 0 auto; position: relative; z-index: 2; padding-top: 70px; }
body.panel .wrap { padding-top: 0; }
.hidden { display: none !important; }
.center { text-align: center; }

/* ── شريط علوي ── */
.menubar { position: fixed; z-index: 50; top: max(10px, env(safe-area-inset-top)); right: max(12px, calc((100vw - 480px) / 2 + 12px)); display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-size: 20px; background: var(--card); border: var(--edge); box-shadow: var(--lift);
  transition: transform .2s, box-shadow .1s;
}
.icon-btn:active { transform: scale(.92); }
.menu-btn {
  display: flex; align-items: center; gap: 8px; padding: 3px 14px 3px 5px; border-radius: 40px;
  color: var(--ink); font-weight: 700; font-size: 15px; background: var(--card); border: var(--edge); box-shadow: var(--lift);
}
.menu-btn .caret { font-size: 11px; transition: transform .2s; }
.menu-btn.open .caret { transform: rotate(180deg); }
.menu-btn .av { width: 36px; height: 36px; font-size: 19px; }
.menu {
  position: absolute; top: 54px; right: 0; width: 248px; padding: 8px; border-radius: 20px;
  background: var(--cloud); border: var(--edge); box-shadow: 0 6px 0 rgba(38, 50, 77, .22);
  transform-origin: top right; animation: menuIn .16s ease;
}
@keyframes menuIn { from { opacity: 0; transform: scale(.94) translateY(-6px); } to { opacity: 1; transform: none; } }
.menu a, .menu button.mi {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 13px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; background: none; text-align: right;
}
.menu a:hover, .menu button.mi:hover { background: var(--sky); }
.menu .mi-ic { width: 28px; text-align: center; font-size: 18px; }
.menu hr { border: 0; border-top: 2px dotted var(--line); margin: 6px 4px; }

/* ── لودر ── */
#loader {
  position: fixed; inset: 0; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--page-bg); transition: opacity .4s ease, visibility .4s ease;
}
#loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo { font-size: 54px; line-height: 1; margin-bottom: 16px; transform-origin: 50% 0; animation: sway 2.4s ease-in-out infinite; }
.loader-bar { width: 150px; height: 8px; border-radius: 8px; background: var(--cloud); border: 2px solid var(--ink); overflow: hidden; }
.loader-bar > i { display: block; height: 100%; width: 40%; background: var(--mint); animation: loadbar 1s ease-in-out infinite; }
.loader-txt { margin-top: 12px; color: var(--ink2); font-size: 15px; font-weight: 600; }
@keyframes loadbar { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }

/* ── الهيدر (مع صورة عائمة) ── */
header { text-align: center; padding: 0 0 14px; }
.chime { display: flex; flex-direction: column; align-items: center; transform-origin: 50% 0; animation: sway 5s ease-in-out infinite; }
.chime .str { width: 2px; height: 26px; background: var(--ink); }
.chime .bell { font-size: 38px; line-height: 1; margin-top: -3px; }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes floatUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.logo-wrap {
  width: 112px; height: 112px; margin: 4px auto 10px; border-radius: 50%;
  background: var(--cloud); border: 3px solid var(--ink);
  box-shadow: 0 0 0 7px var(--mint), 0 8px 0 7px rgba(0, 0, 0, .15);
  animation: floatUp 4.5s ease-in-out infinite;
}
.logo, .logo-wrap .logo { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 50px; background: var(--sky); }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
h1 { margin: 14px 0 0; font-size: 28px; font-weight: 800; line-height: 1.3; text-shadow: 0 2px 0 rgba(0, 0, 0, .1); }
h2 { margin: 0 0 12px; font-size: 18px; font-weight: 800; }
.sub { margin: 2px 0 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.card .sub, .cp-item .sub { color: var(--ink2); }

/* ── إحصائيات ── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 14px; }
.stat { border: var(--edge); border-radius: 18px; box-shadow: var(--lift); background: var(--mint); text-align: center; padding: 8px 4px 6px; color: #1e2a44; }
.stat:nth-child(2) { background: var(--lav); }
.stat:nth-child(3) { background: var(--peach); }
.stat b { display: block; font-size: 26px; font-weight: 800; line-height: 1.3; }
.stat span { font-size: 12.5px; font-weight: 600; }

/* ── كروت ── */
.card { background: var(--card); border: var(--edge); border-radius: 22px; padding: 18px; margin-bottom: 14px; box-shadow: var(--lift); }
label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="tel"], input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; padding: 12px 16px; font: inherit; font-size: 17px; color: var(--ink);
  background: var(--cloud); border: 2px solid var(--ink2); border-radius: 14px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 96px; font-size: 15px; }
input[type="tel"], input[type="password"], #phone { direction: ltr; text-align: left; letter-spacing: 1px; }
input.codein { direction: ltr; text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 10px; }
input::placeholder, textarea::placeholder { color: var(--ink2); opacity: .7; letter-spacing: 0; }
input:focus, textarea:focus { border-color: var(--mint-d); box-shadow: 0 0 0 4px rgba(143, 227, 207, .4); }
input.bad { border-color: var(--bad); }
.hint { color: var(--ink2); font-size: 13.5px; margin: 8px 2px 0; }
.err { color: var(--bad); font-size: 14.5px; margin: 10px 2px 0; font-weight: 700; }
button { font: inherit; cursor: pointer; border: 0; color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--mint-d); outline-offset: 2px; }
.btn {
  width: 100%; margin-top: 14px; padding: 12px; border-radius: 16px; font-size: 18px; font-weight: 800; color: var(--ink);
  background: var(--mint); border: var(--edge); box-shadow: 0 4px 0 var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .1s, box-shadow .1s, opacity .2s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: var(--cloud); font-weight: 700; box-shadow: 0 4px 0 rgba(38, 50, 77, .4); }
.btn.danger { background: #ffb9b9; color: #6b1515; }
.btn.sm { width: auto; margin: 0; padding: 6px 16px; font-size: 15px; border-radius: 12px; box-shadow: 0 3px 0 rgba(38, 50, 77, .4); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, .2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.closed-note { margin-top: 12px; padding: 8px 12px; border-radius: 12px; background: #ffe0e0; border: 2px solid var(--bad); color: #8f2a2a; font-weight: 700; font-size: 14.5px; text-align: center; }
.num { direction: ltr; display: inline-block; font-weight: 800; }
.timer { text-align: center; color: var(--ink2); font-size: 14.5px; margin-top: 10px; }

/* ── كود الاقتران ── */
.code-head { display: flex; align-items: center; gap: 14px; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 74px; height: 74px; }
.ring circle { fill: none; stroke-width: 7; }
.ring .bgc { stroke: var(--line); }
.ring .fg { stroke: var(--mint-d); stroke-linecap: round; stroke-dasharray: 289; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.ring .t { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; direction: ltr; }
.code-title { font-weight: 800; font-size: 18px; }
.code-sub { color: var(--ink2); font-size: 14px; }
.code {
  margin: 16px 0 6px; padding: 14px 10px; border-radius: 18px; text-align: center; direction: ltr;
  font-size: 34px; font-weight: 800; letter-spacing: 6px; background: var(--lav); border: 2px dashed var(--ink); user-select: all; color: #1e2a44;
}
.code i { font-style: normal; display: inline-block; width: 14px; }
.live { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; color: var(--ink2); font-size: 14.5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mint-d); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
ol.steps { list-style: none; margin: 18px 0 0; padding: 0; counter-reset: s; }
ol.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-top: 2px dotted var(--line); font-size: 15px; }
ol.steps li:first-child { border-top: 0; }
ol.steps li::before { content: counter(s); flex: none; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--mint); border: 2px solid var(--ink); color: #1e2a44; }
.ok-ico { width: 76px; height: 76px; border-radius: 50%; margin: 4px auto 12px; display: grid; place-items: center; font-size: 38px; background: var(--mint); border: var(--edge); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); color: #1e2a44; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ok-title { font-size: 22px; font-weight: 800; color: var(--ok); margin: 0; }

/* ── مربعات ── */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile {
  position: relative; text-align: right; min-height: 108px; padding: 12px; border-radius: 20px; color: var(--ink);
  background: var(--card); border: var(--edge); box-shadow: var(--lift); transition: transform .1s, box-shadow .1s;
}
a.tile, .menu a { text-decoration: none; }
.tile.wide { grid-column: 1 / -1; min-height: 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(38, 50, 77, .2); }
.ti { width: 44px; height: 44px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 23px; margin-bottom: 6px; background: var(--a, var(--mint)); border: 2px solid var(--ink); color: #1e2a44; }
.tile.wide .ti { margin: 0; }
.tile b { display: block; font-size: 16.5px; font-weight: 800; line-height: 1.4; }
.tile small { display: block; font-size: 13px; color: var(--ink2); }
.tile .arw { position: absolute; top: 10px; left: 12px; font-size: 20px; font-style: normal; color: var(--ink2); }
.tile.wide .arw { top: 50%; transform: translateY(-50%); }

/* ── شاشات داخلية ── */
.view { animation: slideIn .24s ease both; }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.vh { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: sticky; top: 60px; z-index: 5; padding: 6px 0; }
.bk { width: 38px; height: 38px; border-radius: 13px; font-size: 21px; font-weight: 800; background: var(--card); border: var(--edge); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); color: var(--ink); }
.vh h2 { margin: 0; font-size: 19px; }
.vh p { margin: 0; font-size: 13px; color: var(--ink2); font-weight: 600; }
.q { margin-bottom: 10px; padding: 10px 14px; font-size: 15px; }
.cmd { padding: 10px 12px; margin-bottom: 8px; border-radius: 16px; background: var(--card); border: var(--edge); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.ct { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cmd code { direction: rtl; unicode-bidi: isolate; font-family: inherit; font-weight: 800; font-size: 15px; background: var(--mint); border: 2px solid var(--ink); border-radius: 10px; padding: 1px 10px; word-break: break-all; color: #1e2a44; }
.bt { display: flex; gap: 6px; flex: none; }
.b { padding: 3px 12px; border-radius: 20px; font-size: 13.5px; font-weight: 700; border: 2px solid var(--ink); background: var(--cloud); color: var(--ink); }
.b.cp { background: var(--lav); color: #1e2a44; }
.b:active { transform: scale(.94); }
.cd { margin-top: 4px; font-size: 14px; color: var(--ink2); }
.ex { display: none; margin-top: 8px; padding: 8px 11px; border-radius: 12px; background: var(--sky); font-size: 14px; line-height: 1.8; border-inline-start: 4px solid var(--mint-d); white-space: pre-line; }
.ex.on { display: block; animation: slideIn .2s ease; }
.ex em { display: block; margin-top: 5px; font-style: normal; font-size: 13px; font-weight: 700; }
.em, .empty { text-align: center; padding: 28px 10px; color: var(--ink2); font-size: 15px; }
.em i { display: block; font-size: 34px; margin-bottom: 6px; font-style: normal; }
.tag { font-size: 11.5px; padding: 0 9px; border-radius: 20px; background: var(--butter); border: 1.5px solid var(--ink); font-weight: 700; margin-inline-start: 4px; color: #1e2a44; }

/* شكاوي */
.cp-item { padding: 10px 12px; margin-bottom: 8px; border-radius: 16px; background: var(--card); border: var(--edge); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.cp-item .tx { white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.cp-item .mt { font-size: 12.5px; color: var(--ink2); margin-top: 3px; }
.rep { margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(63, 195, 148, .15); border-inline-start: 4px solid var(--ok); font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.rep small { display: block; color: var(--ok); font-weight: 800; margin-bottom: 2px; }
.wait { color: #a88320; font-size: 13px; margin-top: 6px; }
[data-theme="dark"] .wait { color: #f0c95c; }

/* شات واتساب */
.wa { border-radius: 22px; overflow: hidden; border: var(--edge); box-shadow: var(--lift); display: flex; flex-direction: column; height: min(72vh, 620px); background: var(--cloud); }
.wa-hd { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--sky); border-bottom: 2px solid var(--ink); }
.wa-hd .av { width: 42px; height: 42px; }
.wa-hd b { display: block; font-size: 16px; line-height: 1.3; color: var(--ink); }
.wa-hd small { color: var(--ink2); font-size: 12.5px; }
.wa-hd .st { color: var(--ok); font-weight: 700; }
.wa-hd .gear { margin-inline-start: auto; width: 36px; height: 36px; border-radius: 10px; background: var(--cloud); border: var(--edge); font-size: 17px; display: grid; place-items: center; }
.wa-body { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 5px; background: var(--sky); }
.wa-body::-webkit-scrollbar { width: 4px; } .wa-body::-webkit-scrollbar-thumb { background: var(--ink2); border-radius: 4px; }
.day { align-self: center; margin: 6px 0; padding: 1px 12px; border-radius: 9px; font-size: 12px; color: var(--ink2); background: var(--cloud); border: 1.5px solid var(--line); }
.msg { max-width: 82%; padding: 5px 10px 2px; border-radius: 14px; font-size: 15px; line-height: 1.55; border: 2px solid var(--ink); animation: pop2 .16s ease; position: relative; }
@keyframes pop2 { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.msg.own { align-self: flex-start; background: var(--mint); border-top-right-radius: 3px; color: #1e2a44; }
.msg.oth { align-self: flex-end; background: var(--cloud); border-top-left-radius: 3px; color: var(--ink); }
.msg .who { display: block; font-size: 12px; font-weight: 800; margin-bottom: 1px; color: var(--mint-d); }
.msg .t { white-space: pre-wrap; word-break: break-word; display: block; }
.msg .tm { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: 11px; color: var(--ink2); direction: ltr; }
.msg .tk { color: #2b78c9; font-size: 12px; letter-spacing: -3px; }
.msg .del-x {
  display: none; position: absolute; top: -8px; left: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bad); color: #fff; border: 2px solid var(--ink);
  font-size: 13px; font-weight: 800; align-items: center; justify-content: center; cursor: pointer;
  z-index: 2; line-height: 1;
}
.admin-mode .msg .del-x { display: flex; }
.msg.deleting { opacity: .4; transform: scale(.9); transition: .2s; }
.wa-in { display: flex; gap: 8px; align-items: center; padding: 8px; background: var(--sky); border-top: 2px solid var(--ink); }
.wa-in input { flex: 1; padding: 9px 16px; font-size: 16px; border-radius: 24px; }
.wa-in button { width: 44px; height: 44px; border-radius: 50%; background: var(--mint); border: var(--edge); font-size: 18px; flex: none; display: grid; place-items: center; transform: scaleX(-1); color: #1e2a44; }
.wa-in button:disabled { opacity: .6; }
.wa-closed { padding: 6px 12px; text-align: center; font-size: 13px; font-weight: 700; color: var(--bad); background: rgba(244, 122, 122, .15); border-top: 2px dashed var(--bad); }
.wa-form-closed { opacity: .4; pointer-events: none; }

/* لوحة المطور */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.tab { padding: 6px 4px; border-radius: 14px; font-weight: 700; font-size: 14.5px; background: var(--card); border: var(--edge); box-shadow: 0 3px 0 rgba(0, 0, 0, .2); position: relative; color: var(--ink); }
.tab.on { background: var(--mint); color: #1e2a44; }
.tab i { position: absolute; top: -8px; left: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #ff8a8a; border: 2px solid var(--ink); font-size: 11.5px; font-style: normal; line-height: 16px; color: #1e2a44; }
.chat-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: right; padding: 8px 12px; margin-bottom: 8px; border-radius: 16px; background: var(--card); border: var(--edge); color: var(--ink); }
.chat-row .av { width: 42px; height: 42px; font-size: 18px; }
.chat-row .in { flex: 1; min-width: 0; }
.chat-row b { display: block; font-size: 15px; }
.chat-row small { display: block; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--mint); border: 2px solid var(--ink); font-size: 12px; font-weight: 800; text-align: center; line-height: 18px; color: #1e2a44; }
.bot-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px; border-radius: 16px; background: var(--card); border: var(--edge); }
.bot-row .num { flex: 1; }
.pill { font-size: 12.5px; font-weight: 700; padding: 1px 11px; border-radius: 20px; border: 2px solid var(--ink); }
.pill.on { background: var(--mint); color: #1e2a44; } .pill.off { background: #ffc9c9; color: #6b1515; }
.rbox { margin-top: 8px; display: flex; gap: 6px; }
.rbox textarea { min-height: 44px; height: 44px; padding: 8px 12px; font-size: 14.5px; border-radius: 12px; }

.av { width: 44px; height: 44px; border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center; font-size: 20px; background: var(--sky); border: var(--edge); color: var(--ink); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; }

/* لوحة التحكم (panel) */
.nav { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin: 0 0 16px; background: var(--card); border: var(--edge); border-radius: 22px; box-shadow: var(--lift); position: sticky; top: max(8px, env(safe-area-inset-top)); z-index: 10; }
.nav a { display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 8px 6px; border-radius: 16px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px; line-height: 1.35; }
.nav a.on { background: var(--mint); border: 2px solid var(--ink); color: #1e2a44; }
.imgs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 20px; border: 2px dashed var(--ink); background: var(--sky); overflow: hidden; display: grid; place-items: center; color: var(--ink2); font-size: 14px; cursor: pointer; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .plus { font-size: 30px; line-height: 1; display: block; text-align: center; }
.slot .x { position: absolute; top: 6px; left: 6px; width: 28px; height: 28px; border-radius: 50%; background: var(--cloud); border: 2px solid var(--ink); color: var(--bad); font-size: 17px; font-weight: 800; line-height: 1; z-index: 2; }
.slot .busy { position: absolute; inset: 0; background: rgba(248, 252, 255, .7); display: grid; place-items: center; z-index: 3; }
.g { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px dotted var(--line); }
.g:first-child { border-top: 0; }
.gi { flex: 1; min-width: 0; }
.gn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm { color: var(--ink2); font-size: 13px; }
.sw { position: relative; width: 54px; height: 32px; flex: none; }
.sw input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.sw i { position: absolute; inset: 0; border-radius: 32px; background: var(--cloud); border: var(--edge); transition: .2s; }
.sw i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink2); transition: .2s; }
.sw input:checked + i { background: var(--mint); }
.sw input:checked + i::after { right: 25px; background: #1e2a44; }
.sw input:disabled + i { opacity: .5; }
details { border-top: 2px dotted var(--line); }
details:first-of-type { border-top: 0; }
summary { padding: 10px 2px; font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
summary::-webkit-details-marker { display: none; }
summary small { color: var(--ink2); font-weight: 600; }
#cList .cmd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 15px; padding: 4px 4px 4px 0; margin: 0; background: none; border: 0; box-shadow: none; }
#cList .cmd code { direction: ltr; padding: 0 9px; font-size: 14px; }

/* فوتر */
footer { text-align: center; color: var(--ink); font-size: 14px; font-weight: 600; margin-top: 18px; }
.wa-chan {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 18px 6px 14px; margin-bottom: 10px; border-radius: 40px;
  color: #1e2a44; text-decoration: none; font-weight: 800; font-size: 15.5px;
  background: var(--mint); border: var(--edge); box-shadow: 0 4px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.wa-chan:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.wa-chan svg { fill: #1e2a44; }
footer a { color: var(--ink); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--cloud); border: var(--edge); box-shadow: var(--lift); padding: 8px 18px; border-radius: 16px;
  font-size: 15px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; z-index: 9000; text-align: center; color: var(--ink);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #ffe0e0; border-color: var(--bad); color: #6b1515; }
.toast.good { background: #d7f5ea; border-color: var(--ok); color: #1e3a2e; }

/* ── لوحة التخصيص ── */
.set-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .25s; }
.set-overlay.on { opacity: 1; pointer-events: auto; }
.set-drawer {
  position: fixed; top: 0; bottom: 0; right: -100%; width: min(340px, 92vw); z-index: 301;
  background: var(--cloud); border-inline-start: var(--edge);
  box-shadow: -8px 0 32px rgba(0, 0, 0, .3);
  transition: right .28s ease; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 18px; color: var(--ink);
}
.set-drawer.on { right: 0; }
.set-drawer h3 { margin: 0; font-size: 18px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.set-close { width: 34px; height: 34px; border-radius: 10px; background: var(--sky); border: var(--edge); font-size: 20px; font-weight: 700; color: var(--ink); }
.set-sec label { display: block; margin-bottom: 8px; font-weight: 800; font-size: 14px; }
.set-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--ink); cursor: pointer; transition: transform .1s; position: relative; overflow: hidden; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #1e2a44; background-size: cover; background-position: center; }
.swatch:active { transform: scale(.94); }
.swatch.on { box-shadow: 0 0 0 3px var(--mint-d); }
.swatch.on::after { content: "✓"; position: absolute; inset: 0; background: rgba(0, 0, 0, .25); display: grid; place-items: center; color: #fff; font-size: 22px; }
.swatch[data-bgopt="cartoon"]  { background-image: url("https://i.ibb.co/Mxr96ZJ1/image-1793585700041.jpg"); }
.swatch[data-bgopt="space"]    { background-image: url("https://images.unsplash.com/photo-1462331940025-496dfbfc7564?w=200&auto=format&q=60"); }
.swatch[data-bgopt="stars"]    { background-image: url("https://images.unsplash.com/photo-1419242902214-272b3f66ee7a?w=200&auto=format&q=60"); }
.swatch[data-bgopt="clouds"]   { background-image: url("https://images.unsplash.com/photo-1513002749550-c59d786b8e6c?w=200&auto=format&q=60"); }
.swatch[data-bgopt="nature"]   { background-image: url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=200&auto=format&q=60"); }
.swatch[data-bgopt="plain"]    { background: var(--sky); }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-row button { padding: 10px; border-radius: 12px; border: var(--edge); background: var(--sky); font-weight: 700; font-size: 14px; color: var(--ink); }
.mode-row button.on { background: var(--mint); color: #1e2a44; }
.bright-row { display: flex; gap: 10px; align-items: center; }
.bright-row input[type="range"] { flex: 1; accent-color: var(--mint-d); }
.bright-row span { font-size: 13px; font-weight: 800; min-width: 44px; text-align: center; direction: ltr; }

/* ── مودال أدمن ── */
.adm-modal { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.adm-modal.on { opacity: 1; pointer-events: auto; }
.adm-card { background: var(--cloud); border: var(--edge); border-radius: 22px; padding: 20px; width: 100%; max-width: 340px; box-shadow: 0 8px 0 rgba(0, 0, 0, .3); }
.adm-card h3 { margin: 0 0 12px; font-size: 18px; }
.adm-card input { margin-bottom: 8px; }

/* ── متفرقات ── */
@media (prefers-reduced-motion: reduce) {
  .chime, .loader-logo, .dot, .view, .menu, .ok-ico, .logo-wrap { animation: none !important; }
}