/* CCRAFT SPACE — Hubs (مشترك بين hubs.html و hub.html) */
body.hb {
    --ink: #07060b;
    --panel: #0d0b14;
    --raise: #14111d;
    --line: rgba(167, 139, 250, 0.16);
    --hair: rgba(255, 255, 255, 0.06);
    --violet: #8b5cf6;
    --violet-deep: #6d3fe0;
    --violet-soft: #c4b5fd;
    --violet-dim: rgba(139, 92, 246, 0.14);
    --text: #f4f1fb;
    --mute: #8d87a3;
    --good: #4ade80;
    --bad: #f87171;
    --r-lg: 22px;
    --r-md: 14px;
    --font-title: 'El Messiri', 'Tajawal', sans-serif;
    background:
        radial-gradient(860px 380px at 85% -150px, rgba(139, 92, 246, 0.16), transparent 70%),
        var(--ink);
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
}

/* عناوين الصفحة بيضا هادية (الموقع بيدّي h1/h2 تدرّج بنفسجي افتراضي) */
.hb-title h1, .hub-title-lg, .sec-h, .create-panel h2, .dialog h3, .empty h3, .hub-name {
    background: none; -webkit-text-fill-color: currentColor; color: var(--text); text-shadow: none;
}
.hb-wrap { max-width: 960px; margin: 0 auto; padding: 0 20px 96px; }
.hb-wrap.narrow { max-width: 780px; }

/* ---------- أزرار ---------- */
.hb-wrap button, .hb-modal button { margin: 0; font-family: 'Tajawal', sans-serif; }
.hb-wrap button:hover, .hb-modal button:hover { transform: none; filter: none; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: var(--r-md); padding: 11px 20px;
    font-size: 0.88rem; font-weight: 800; cursor: pointer; text-decoration: none; white-space: nowrap;
    color: #fff; background: linear-gradient(135deg, var(--violet) 0%, var(--violet-deep) 100%);
    box-shadow: 0 8px 22px -8px rgba(139, 92, 246, 0.6);
    transition: box-shadow .25s ease, background .25s ease, border-color .25s ease, color .25s ease;
}
.btn:hover { box-shadow: 0 10px 28px -6px rgba(139, 92, 246, 0.75); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--violet-soft); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--violet-dim); border-color: rgba(167, 139, 250, 0.4); }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(248, 113, 113, 0.28); box-shadow: none; }
.btn.danger:hover { background: rgba(248, 113, 113, 0.1); }
.btn.sm { padding: 7px 14px; font-size: 0.78rem; border-radius: 11px; }
.btn.icon { padding: 0; width: 36px; height: 36px; border-radius: 11px; }
:is(.btn, .tab, .hb-search input, .field input, .field textarea, .composer textarea, .pick):focus-visible {
    outline: 2px solid var(--violet-soft); outline-offset: 2px;
}

/* ---------- حقول ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field > label, .field > .lbl { font-size: 0.8rem; font-weight: 800; color: var(--violet-soft); }
.field input[type=text], .field textarea {
    width: 100%; box-sizing: border-box; margin: 0;
    background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-md);
    padding: 12px 15px; color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.92rem;
    outline: none; transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus { border-color: rgba(167, 139, 250, 0.5); box-shadow: 0 0 0 4px var(--violet-dim); }
.field textarea { resize: vertical; min-height: 130px; line-height: 1.8; }
.field .hint { font-size: 0.74rem; color: var(--mute); line-height: 1.7; }
.field .hint bdi { color: var(--violet-soft); }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 90px);
    display: flex; align-items: center; gap: 10px; max-width: min(92vw, 420px);
    background: var(--raise); border: 1px solid var(--line); border-radius: 50px;
    padding: 11px 22px; font-size: 0.86rem; font-weight: 700; color: var(--text);
    z-index: 900; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); pointer-events: none;
    opacity: 0; visibility: hidden;
    transition: transform .4s cubic-bezier(.2, .9, .3, 1.15), opacity .25s ease, visibility .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast i { color: var(--violet-soft); }
.toast.ok i { color: var(--good); }
.toast.err i { color: var(--bad); }

/* ---------- حركة دخول واحدة ---------- */
@keyframes hbIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.enter { animation: hbIn .6s cubic-bezier(.2, .8, .2, 1) both; }
@media (prefers-reduced-motion: reduce) { .enter { animation: none; } .toast { transition: none; } }

/* ============ hubs.html ============ */
.hb-hero { padding: 40px 0 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hb-title { display: flex; align-items: center; gap: 16px; }
.hb-title .mark {
    width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 1.3rem; color: var(--violet-soft);
    background: var(--violet-dim); border: 1px solid var(--line);
}
.hb-title h1 { font-family: var(--font-title); font-size: clamp(1.7rem, 4.4vw, 2.3rem); font-weight: 700; margin: 0; line-height: 1.2; }
.hb-title p { color: var(--mute); font-size: 0.86rem; margin: 5px 0 0; line-height: 1.7; }

.create-panel { display: none; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; margin-bottom: 26px; }
.create-panel.show { display: block; }
.create-panel h2 { font-family: var(--font-title); font-size: 1.2rem; margin: 0 0 20px; font-weight: 700; }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.hb-search { position: relative; margin-bottom: 26px; }
.hb-search i { position: absolute; inset-inline-start: 18px; top: 50%; transform: translateY(-50%); color: var(--mute); pointer-events: none; }
.hb-search input {
    width: 100%; box-sizing: border-box; margin: 0; background: var(--panel);
    border: 1px solid var(--hair); border-radius: 50px; padding: 14px 20px; padding-inline-start: 48px;
    color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.92rem; outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.hb-search input:focus { border-color: rgba(167, 139, 250, 0.5); box-shadow: 0 0 0 4px var(--violet-dim); }

.hub-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .hub-grid { grid-template-columns: 1fr 1fr; } }
.hub-card {
    display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden;
    background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-lg);
    transition: border-color .3s ease, box-shadow .3s ease;
}
.hub-card:hover { border-color: rgba(167, 139, 250, 0.38); box-shadow: 0 18px 50px -24px rgba(139, 92, 246, 0.55); }
.hub-card .cover {
    height: 104px; background: linear-gradient(135deg, #2b1b57, #120f24) center / cover;
    -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}
.hub-card .body { padding: 0 22px 22px; margin-top: -38px; display: flex; flex-direction: column; flex: 1; }
.hub-icon {
    width: 64px; height: 64px; border-radius: 20px; overflow: hidden; flex-shrink: 0;
    display: grid; place-items: center; color: #fff; font-family: var(--font-title); font-size: 1.6rem; font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #5b32c4);
    box-shadow: 0 0 0 4px var(--panel), 0 0 0 5px var(--line);
}
.hub-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-name { font-family: var(--font-title); font-size: 1.2rem; font-weight: 700; margin: 14px 0 3px; display: flex; align-items: center; gap: 8px; }
.hub-name .vf { color: #7dd3fc; font-size: 0.9rem; }
.hub-owner { font-size: 0.78rem; color: var(--mute); display: flex; align-items: center; gap: 6px; }
.hub-desc {
    font-size: 0.86rem; color: #b6b0c9; line-height: 1.8; margin: 12px 0 18px; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hub-desc.none { color: var(--mute); font-style: normal; }
.hub-foot { display: flex; gap: 20px; padding-top: 16px; border-top: 1px solid var(--hair); font-size: 0.8rem; color: var(--mute); }
.hub-foot span { display: inline-flex; align-items: center; gap: 7px; }
.hub-foot i { color: var(--violet-soft); font-size: 0.82rem; }
.hub-foot b { color: var(--text); font-weight: 800; }

.skel { height: 232px; border-radius: var(--r-lg); background: linear-gradient(100deg, var(--panel) 30%, var(--raise) 50%, var(--panel) 70%) 0 0 / 220% 100%; animation: hbSkel 1.6s ease-in-out infinite; border: 1px solid var(--hair); }
@keyframes hbSkel { to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

.empty { grid-column: 1 / -1; text-align: center; padding: 70px 20px; color: var(--mute); }
.empty .ico { width: 68px; height: 68px; border-radius: 22px; margin: 0 auto 18px; display: grid; place-items: center; font-size: 1.6rem; color: var(--violet-soft); background: var(--violet-dim); border: 1px solid var(--line); }
.empty h3 { font-family: var(--font-title); font-size: 1.15rem; color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0 0 18px; font-size: 0.86rem; line-height: 1.8; }

/* ============ hub.html ============ */
.hub-cover { position: relative; height: 200px; background: linear-gradient(135deg, #2b1b57, #120f24) center / cover; }
.hub-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 6, 11, 0) 35%, var(--ink) 100%); }
@media (max-width: 600px) { .hub-cover { height: 150px; } }

.hub-head { margin-top: -62px; position: relative; z-index: 1; }
.hub-head .hub-icon { width: 96px; height: 96px; border-radius: 28px; font-size: 2.3rem; box-shadow: 0 0 0 5px var(--ink), 0 0 0 6px var(--line), 0 18px 50px -12px rgba(139, 92, 246, 0.6); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hub-title-lg { font-family: var(--font-title); font-size: clamp(1.7rem, 5vw, 2.3rem); font-weight: 700; margin: 20px 0 6px; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hub-title-lg .vf { color: #7dd3fc; font-size: 1.1rem; }
.hub-sub { font-size: 0.84rem; color: var(--mute); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hub-sub i { color: var(--violet-soft); }
.hub-sub bdi { color: var(--violet-soft); }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 22px 0 6px; }
.stat-row .st { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; color: var(--mute); }
@media (min-width: 601px) {
    .stat-row { gap: 10px 0; }
    .stat-row .st { padding: 4px 24px; }
    .stat-row .st:first-child { padding-inline-start: 0; }
    .stat-row .st + .st { border-inline-start: 1px solid var(--hair); }
}
.stat-row .st i { color: var(--violet-soft); }
.stat-row .st b { color: var(--text); font-weight: 800; font-size: 1rem; }
.pending-note { color: var(--mute); font-size: 0.82rem; display: inline-flex; align-items: center; gap: 8px; }

.tabs { display: flex; gap: 4px; margin: 26px 0 28px; border-bottom: 1px solid var(--hair); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 9px; padding: 13px 18px; background: none; border: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--mute); font-size: 0.9rem; font-weight: 800;
    cursor: pointer; white-space: nowrap; transition: color .2s ease, border-color .2s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--violet-soft); border-bottom-color: var(--violet); }
.tab .cnt { background: var(--violet); color: #fff; border-radius: 50px; font-size: 0.68rem; padding: 1px 8px; font-weight: 800; }

.sec-h { display: flex; align-items: center; gap: 10px; font-family: var(--font-title); font-size: 1.1rem; font-weight: 700; margin: 34px 0 14px; }
.sec-h:first-child { margin-top: 0; }
.sec-h i { color: var(--violet-soft); font-size: 0.95rem; }
.sec-h .n { font-family: 'Tajawal', sans-serif; font-size: 0.78rem; color: var(--mute); font-weight: 700; }

.about { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 26px; font-size: 0.96rem; line-height: 2; white-space: pre-wrap; word-break: break-word; max-width: 70ch; }
.quiet { color: var(--mute); font-size: 0.88rem; line-height: 1.9; }

.gs-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 560px) { .gs-grid { grid-template-columns: 1fr 1fr; } }
.gs-card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--hair); border-radius: 18px; overflow: hidden; transition: border-color .3s ease; }
.gs-card:hover { border-color: rgba(167, 139, 250, 0.38); }
.gs-card .thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1d1538, #0e0b1a) center / cover; display: grid; place-items: center; color: rgba(196, 181, 253, 0.25); font-size: 1.8rem; }
.gs-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gs-card .in { padding: 14px 18px 18px; }
.gs-card .t { font-weight: 800; font-size: 0.95rem; line-height: 1.6; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.gs-card .m { display: flex; gap: 16px; font-size: 0.78rem; color: var(--mute); }
.gs-card .m span { display: inline-flex; align-items: center; gap: 6px; }
.gs-card .m i { color: var(--violet-soft); }

.people { border-top: 1px solid var(--hair); }
.person { display: flex; align-items: center; gap: 14px; padding: 16px 2px; border-bottom: 1px solid var(--hair); flex-wrap: wrap; }
.av { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, #8b5cf6, #5b32c4); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person .nm { font-weight: 800; font-size: 0.94rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.person .sub { font-size: 0.76rem; color: var(--mute); margin-top: 3px; }
.person .ctl { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.person .note { flex-basis: 100%; font-size: 0.84rem; color: #b6b0c9; line-height: 1.8; white-space: pre-wrap; word-break: break-word; padding-inline-start: 58px; }
.role { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 800; padding: 3px 11px; border-radius: 50px; background: var(--violet-dim); color: var(--violet-soft); }
.role.owner { background: rgba(250, 204, 21, 0.12); color: #fcd34d; }

.pick { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r-md); cursor: pointer; background: var(--panel); transition: border-color .2s ease, background .2s ease; }
.pick:hover { border-color: rgba(167, 139, 250, 0.5); background: var(--violet-dim); }
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick .pv { width: 64px; height: 64px; border-radius: 16px; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; background: var(--raise); color: var(--violet-soft); font-size: 1.3rem; }
.pick .pv.wide { width: 112px; height: 56px; }
.pick .pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick .tx { font-size: 0.84rem; font-weight: 700; line-height: 1.7; }
.pick .tx small { display: block; color: var(--mute); font-weight: 500; font-size: 0.74rem; }
.settings { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 26px; }
.danger-zone { border: 1px solid rgba(248, 113, 113, 0.22); border-radius: var(--r-lg); padding: 22px 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.danger-zone .tx { font-size: 0.84rem; color: var(--mute); line-height: 1.8; max-width: 46ch; }
.danger-zone .tx b { color: var(--text); display: block; margin-bottom: 2px; }

/* ---------- بطاقة الشات في رأس الصفحة ---------- */
.chat-promo {
    display: flex; align-items: center; gap: 16px; width: 100%; margin: 22px 0 0; padding: 15px 18px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
    color: var(--text); text-align: start; cursor: pointer; min-width: 0; box-shadow: none;
    transition: border-color .25s ease, background .25s ease;
}
.chat-promo:hover { border-color: rgba(167, 139, 250, 0.45); background: var(--raise); }
.chat-promo .cp-ico { position: relative; width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; font-size: 1.1rem; color: var(--violet-soft); background: var(--violet-dim); }
.chat-promo .cp-dot { position: absolute; top: -3px; inset-inline-end: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--panel); }
.chat-promo.locked .cp-dot { display: none; }
.chat-promo .cp-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.chat-promo .cp-tx b { font-size: 0.98rem; font-weight: 800; }
.chat-promo .cp-tx small { font-size: 0.8rem; color: var(--mute); line-height: 1.7; font-weight: 500; }
.chat-promo .cp-go { color: var(--violet-soft); font-size: 0.85rem; }

.tab .live { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: hbPulse 2.4s ease-out infinite; }
.tab .lock { font-size: 0.7rem; opacity: .65; }
@keyframes hbPulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } }
@media (prefers-reduced-motion: reduce) { .tab .live { animation: none; } }

/* ---------- الشات ---------- */
.chat { position: relative; background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-lg); display: flex; flex-direction: column; height: min(76vh, 660px); overflow: hidden; }
.chat-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.chat-bar .ttl { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 0.95rem; }
.chat-bar .ttl i { color: var(--violet-soft); }
.chat-bar .online { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--mute); }
.chat-bar .online .d { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.notice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 16px 0; padding: 10px 14px; background: rgba(252, 211, 77, 0.07); border: 1px solid rgba(252, 211, 77, 0.2); border-radius: 12px; font-size: 0.78rem; line-height: 1.8; color: #e9dfb0; }
.notice i { color: #fcd34d; margin-top: 5px; }
.msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 8px 16px 10px; scrollbar-width: thin; scrollbar-color: rgba(167, 139, 250, 0.3) transparent; overscroll-behavior: contain; }
.day { align-self: center; margin: 16px 0 6px; }
.day span { font-size: 0.72rem; color: var(--mute); background: var(--raise); border: 1px solid var(--hair); padding: 3px 13px; border-radius: 50px; }
.msg { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; max-width: min(88%, 540px); align-self: flex-end; flex-direction: row-reverse; }
.msg.cont { margin-top: 3px; }
.msg.mine { align-self: flex-start; flex-direction: row; }
.msg .av { width: 34px; height: 34px; font-size: 0.8rem; }
.msg.cont .av { visibility: hidden; }
.msg.mine .av { display: none; }
.msg .bubble { min-width: 0; }
.msg .h { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--mute); margin-bottom: 4px; padding-inline: 4px; }
.msg .h b { color: #d8d0f5; font-weight: 800; }
.msg.mine .h b { display: none; }
.msg .b { background: var(--raise); border: 1px solid var(--hair); border-radius: 16px; border-end-end-radius: 5px; padding: 9px 14px; font-size: 0.9rem; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.msg.mine .b { background: rgba(139, 92, 246, 0.2); border-color: rgba(167, 139, 250, 0.3); border-end-end-radius: 16px; border-end-start-radius: 5px; }
.msg .del { background: none; border: none; box-shadow: none; color: var(--mute); cursor: pointer; padding: 2px 5px; font-size: 0.72rem; opacity: 0; transition: opacity .2s ease, color .2s ease; min-width: unset; }
.msg:hover .del, .msg .del:focus-visible { opacity: .75; }
.msg .del:hover { color: var(--bad); opacity: 1; }
@media (hover: none) { .msg .del { opacity: .5; } }
.chat-empty { margin: auto; text-align: center; color: var(--mute); font-size: 0.88rem; line-height: 1.9; padding: 30px 20px; }
.chat-empty .ico { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 1.3rem; color: var(--violet-soft); background: var(--violet-dim); }
.jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 2; display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 50px; background: var(--violet-deep); color: #fff; border: none; font-size: 0.78rem; font-weight: 800; cursor: pointer; box-shadow: 0 10px 26px rgba(0, 0, 0, .5); min-width: unset; }
.jump[hidden] { display: none; }
.composer { position: relative; display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px 14px; border-top: 1px solid var(--hair); }
.composer textarea {
    flex: 1; box-sizing: border-box; margin: 0; height: 46px; min-height: 46px; max-height: 130px; resize: none; background: var(--raise);
    border: 1px solid var(--hair); border-radius: 23px; padding: 12px 18px; color: var(--text); line-height: 1.6;
    font-family: 'Tajawal', sans-serif; font-size: 0.92rem; outline: none; transition: border-color .2s ease;
}
.composer textarea:focus { border-color: rgba(167, 139, 250, 0.5); }
.composer .btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.composer .btn i { transform: scaleX(-1); }
.composer .cnt { position: absolute; inset-inline-start: 24px; top: -3px; font-size: 0.7rem; color: var(--mute); display: none; }
.composer .cnt.show { display: block; }
.composer .cnt.warn { color: var(--bad); }
.lock-card { background: var(--panel); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 44px 24px; text-align: center; }
.lock-card .ico { width: 62px; height: 62px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; font-size: 1.4rem; color: var(--violet-soft); background: var(--violet-dim); }
.lock-card h3 { font-family: var(--font-title); font-size: 1.15rem; margin: 0 0 8px; background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
.lock-card p { color: var(--mute); font-size: 0.88rem; line-height: 1.9; margin: 0 auto 20px; max-width: 42ch; }

/* ---------- إعلان إنشاء مجموعة + ترتيب ---------- */
.promo { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; padding: 22px 24px; background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(139, 92, 246, 0.04)); border: 1px solid var(--line); border-radius: var(--r-lg); }
.promo h2 { font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; margin: 0 0 6px; background: none; -webkit-text-fill-color: currentColor; color: var(--text); text-shadow: none; }
.promo p { color: #b6b0c9; font-size: 0.86rem; line-height: 1.9; margin: 0 0 12px; max-width: 52ch; }
.promo ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.promo li { font-size: 0.8rem; color: var(--violet-soft); display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.sortnote { display: flex; align-items: center; gap: 8px; margin: -10px 0 18px; font-size: 0.8rem; color: var(--mute); }
.sortnote i { color: var(--violet-soft); }
.hub-card { position: relative; }
.rank { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 800; padding: 4px 11px; border-radius: 50px; background: rgba(7, 6, 11, 0.7); backdrop-filter: blur(6px); border: 1px solid var(--line); color: var(--violet-soft); }
.rank.r1 { color: #fcd34d; border-color: rgba(252, 211, 77, .35); }
.rank.r2 { color: #d4d4d8; border-color: rgba(212, 212, 216, .3); }
.rank.r3 { color: #e0a370; border-color: rgba(224, 163, 112, .3); }

/* ---------- نافذة تأكيد ---------- */
.hb-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(4, 3, 8, 0.72); backdrop-filter: blur(6px); }
.hb-modal[hidden] { display: none; }
.dialog { width: min(100%, 420px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.dialog h3 { font-family: var(--font-title); font-size: 1.2rem; margin: 0 0 8px; font-weight: 700; }
.dialog p { color: var(--mute); font-size: 0.88rem; line-height: 1.9; margin: 0 0 18px; }
.dialog textarea { width: 100%; box-sizing: border-box; margin: 0 0 18px; min-height: 90px; resize: vertical; background: var(--ink); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 12px 14px; color: var(--text); font-family: 'Tajawal', sans-serif; font-size: 0.9rem; outline: none; }
.dialog textarea:focus { border-color: rgba(167, 139, 250, 0.5); }
.dialog .row-actions { gap: 8px; }

.state { text-align: center; padding: 90px 20px; color: var(--mute); }
.state i { font-size: 1.4rem; color: var(--violet-soft); margin-bottom: 14px; display: block; }

/* ===== v2: زر الشات هادي + شات بشاشة كاملة زي شات الموقع ===== */
.chat-promo { background: var(--panel) !important; box-shadow: none !important; filter: none !important; transform: none !important; margin: 18px 0 0; padding: 12px 14px; gap: 12px; border-radius: 16px; font-family: inherit; }
.chat-promo:hover { background: var(--raise) !important; }
.chat-promo .cp-ico { width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; background: rgba(139, 92, 246, 0.12); color: #b9a6f7; }
.chat-promo .cp-tx b { font-size: 0.92rem; }
.chat-promo .cp-tx small { font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-promo .cp-go { color: var(--mute); font-size: 0.75rem; }

body.chat-open { overflow: hidden; }
body.chat-open #ccraftLangFab, body.chat-open header, body.chat-open .toast { display: none !important; }
body.chat-open .toast.show { display: flex !important; z-index: 1200; }
.chat { position: fixed; inset: 0; z-index: 1000; height: 100dvh; width: 100%; max-width: 760px; margin: 0 auto; border: 0; border-radius: 0; background: var(--ink); }
@media (min-width: 761px) { .chat { border-inline: 1px solid var(--hair); } }
.chat-bar { gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--panel); }
.chat-bar .back { width: 38px; height: 38px; min-width: 0; margin: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; background: none; border: 0; box-shadow: none; color: var(--text); font-size: 1.05rem; cursor: pointer; filter: none; transform: none; }
.chat-bar .back:hover { background: var(--raise); }
.chat-bar .ttl { flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.chat-bar .ttl b { font-size: 0.95rem; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-bar .ttl small { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--mute); font-weight: 500; }
.chat-bar .ttl small .d { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.notice { margin: 8px 10px 0; padding: 6px 12px; font-size: 0.72rem; line-height: 1.6; align-items: center; }
.notice i { margin-top: 0; }
.msgs { padding: 6px 10px 10px; }
.msg { margin-top: 8px; gap: 7px; max-width: 100%; align-self: auto; flex-direction: row; justify-content: flex-start; align-items: flex-end; }
.msg.cont { margin-top: 1px; }
.msg .av { width: 30px; height: 30px; font-size: 0.75rem; }
.msg.mine { flex-direction: row; justify-content: flex-start; }
.msg .bubble { max-width: 80%; display: flex; flex-direction: column; gap: 2px; }
.msg .h { margin: 0; padding: 0 10px; font-size: 0.7rem; }
.msg .h span { opacity: .6; }
.msg .b { padding: 8px 13px; border-radius: 20px; border-end-start-radius: 6px; border-end-end-radius: 20px; font-size: 0.93rem; line-height: 1.55; background: var(--panel); border: 1px solid var(--hair); }
.msg.cont .b { border-start-start-radius: 6px; }
.msg.mine .b { background: linear-gradient(135deg, #8b5cf6, #6d3fe0); border-color: transparent; color: #fff; border-end-start-radius: 20px; border-end-end-radius: 6px; }
.msg .del { align-self: center; }
.jump { bottom: 78px; }
.composer { gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); align-items: flex-end; }
.composer .cwrap { flex: 1; min-width: 0; background: var(--raise); border: 1px solid var(--hair); border-radius: 24px; padding: 3px 6px; transition: border-color .2s, box-shadow .2s; }
.composer .cwrap:focus-within { border-color: rgba(167, 139, 250, .55); box-shadow: 0 0 0 3px rgba(139, 92, 246, .12); }
.composer textarea { width: 100%; height: 40px; min-height: 40px; max-height: 120px; background: none !important; border: 0 !important; border-radius: 0; padding: 9px 10px; font-size: 16px; box-shadow: none !important; }
.composer .send { width: 42px; height: 42px; min-width: 0; margin: 0; padding: 0; border-radius: 50%; border: 0; flex-shrink: 0; display: grid; place-items: center; cursor: pointer; background: linear-gradient(135deg, #8b5cf6, #6d3fe0); color: #fff; box-shadow: none; filter: none; transform: none; }
.composer .send:disabled { opacity: .4; cursor: default; }
.composer .send i { transform: scaleX(-1); }
.composer .cnt { top: -16px; }

/* ===== v3 ===== */
.hb textarea { font-family: 'Tajawal', sans-serif !important; color: var(--text) !important; transform: none !important; }
.hb .field textarea.short { min-height: 64px; height: 64px; max-height: 220px; resize: none; overflow-y: auto; padding: 14px 18px; }
.gs-card { padding: 0 !important; position: static !important; transform: none !important; box-shadow: none !important; }
.gs-card::before { display: none !important; content: none !important; }
.gs-card:hover { transform: none !important; }
.gs-card .t { -webkit-line-clamp: 2; min-height: 3.2em; }
.gs-card .in { padding: 12px 14px 14px; }
.gs-card .m { gap: 14px; font-size: 0.76rem; }
@media (max-width: 559px) { .gs-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .gs-card .in { padding: 10px 12px 12px; } .gs-card .t { font-size: 0.86rem; } }
.composer textarea { transform: none !important; margin: 0 !important; color: var(--text) !important; }

/* رسايل زي شات الموقع: الباقي على اليمين، رسايلي على الشمال */
.msg { align-self: flex-start; flex-direction: row; justify-content: flex-start; max-width: 100%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .b { border-end-start-radius: 6px; border-end-end-radius: 20px; }
.msg.mine .b { border-end-start-radius: 20px; border-end-end-radius: 6px; }
.msg .del { opacity: .35; padding: 6px; }
body.chat-open .hb-wrap, body.chat-open .hb-wrap * { animation: none !important; }
body.chat-open .hb-wrap { transform: none !important; will-change: auto !important; }
.chat-bar .back { background: transparent !important; box-shadow: none !important; border: 0 !important; width: 38px !important; height: 38px !important; }

/* v4: التبويبات بتتوزع على العرض من غير سكرول (عشان زرار الإدارة ما يختفيش) */
.tabs { overflow-x: visible; }
.tab { flex: 1 1 0; justify-content: center; min-width: 0; padding-inline: 8px; white-space: nowrap; }
@media (max-width: 560px) {
    .tab { font-size: 0.78rem; gap: 5px; padding-inline: 4px; }
    .tab > i.fa-solid:first-child { display: none; }
}
