/* =========================================================
   Despair — الفرق، الترجمات المتعددة، التفاعلات
   ========================================================= */

/* =========================================================
   0. عناصر مشتركة
   ========================================================= */

.dsp-sec-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}
.dsp-sec-title i { color: var(--primary-400); font-size: 14px; }

.dsp-btn--lg { padding: 14px 26px; font-size: 15.5px; }
.dsp-btn--danger {
    background: linear-gradient(135deg, #f87171, #dc2626);
    box-shadow: 0 8px 24px rgba(239, 68, 68, .3);
}
.dsp-btn.is-busy { opacity: .6; pointer-events: none; }
.dsp-btn.is-disabled { opacity: .55; pointer-events: none; background: var(--surface2); color: var(--text2); border-color: var(--border2); box-shadow: none; }

.dsp-linkbtn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary-400);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.dsp-linkbtn:hover { text-decoration: underline; }

/* حقول */
.dsp-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.dsp-field label { font-size: 13px; font-weight: 700; color: var(--text2); }

.dsp-field input[type="text"],
.dsp-field input[type="url"],
.dsp-field input[type="email"],
.dsp-field select,
.dsp-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.dsp-field textarea { resize: vertical; line-height: 1.8; }

.dsp-field input:focus,
.dsp-field select:focus,
.dsp-field textarea:focus {
    outline: 0;
    border-color: var(--primary-color);
    background: var(--surface3);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.dsp-field input[type="color"] {
    width: 56px;
    height: 40px;
    padding: 3px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    cursor: pointer;
}

.dsp-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dsp-field--full { grid-column: 1 / -1; }

.dsp-colorrow { display: flex; align-items: center; gap: 12px; }
.dsp-colorhint { color: var(--text3); font-size: 12px; }

.dsp-mini-select {
    padding: 7px 10px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.dsp-mini-select:focus { outline: 0; border-color: var(--primary-color); }

/* أزرار أيقونية للإجراءات */
.dsp-iconaction {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    transition: all var(--t-fast);
}
.dsp-iconaction:hover { color: var(--text); border-color: var(--primary-color); background: var(--primary-soft); }
.dsp-iconaction--danger:hover { color: #fff; background: var(--color-danger); border-color: var(--color-danger); }
.dsp-iconaction.is-busy { opacity: .5; pointer-events: none; }

/* حالة فارغة */
.dsp-blank {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 56px 22px;
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
    color: var(--text2);
}
.dsp-blank i { font-size: 34px; color: var(--text3); }
.dsp-blank p { margin: 0; font-size: 14.5px; }

/* تنبيه عائم — التعريف الموحّد في theme-ui.css */

/* نافذة منبثقة */
.dsp-modal { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 18px; }
.dsp-modal[hidden] { display: none; }

.dsp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity var(--t);
}
.dsp-modal.is-open .dsp-modal-backdrop { opacity: 1; }

.dsp-modal-box {
    position: relative;
    width: min(560px, 100%);
    max-height: min(86vh, 760px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(18px) scale(.97);
    transition: opacity var(--t), transform var(--t) var(--ease-out);
}
.dsp-modal.is-open .dsp-modal-box { opacity: 1; transform: translateY(0) scale(1); }

.dsp-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.dsp-modal-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 16.5px; font-weight: 800; }
.dsp-modal-head h2 i { color: var(--primary-400); font-size: 14px; }

.dsp-modal-x {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-modal-x:hover { color: var(--text); background: var(--surface3); }

.dsp-modal-body { padding: 20px; overflow-y: auto; }
.dsp-modal-foot { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* =========================================================
   1. شارة الفريق
   ========================================================= */

.dsp-team-badge {
    --team-color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 11px 4px 5px;
    border: 1px solid color-mix(in srgb, var(--team-color) 34%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--team-color) 12%, transparent);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    transition: all var(--t-fast);
}
.dsp-team-badge:hover { background: color-mix(in srgb, var(--team-color) 22%, transparent); border-color: var(--team-color); }

.dsp-team-badge-logo {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--team-color);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}
.dsp-team-badge-logo img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   2. فلتر الفرق أعلى قائمة الفصول
   ========================================================= */

.dsp-tfilter-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-soft), transparent 70%), var(--surface);
}

.dsp-tfilter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    color: var(--primary-400);
    font-size: 12.5px;
    font-weight: 800;
}
.dsp-tfilter-label i { font-size: 14px; }

.dsp-tfilter-chips {
    display: flex;
    gap: 7px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
}
.dsp-tfilter-chips::-webkit-scrollbar { display: none; }

.dsp-tfilter {
    --team-color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    padding: 7px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-pill);
    background: var(--surface2);
    color: var(--text2);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--t-fast);
}
.dsp-tfilter img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.dsp-tfilter i { font-size: 11px; opacity: .8; }

.dsp-tfilter b {
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--tint-1);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.dsp-tfilter:hover { color: var(--text); border-color: var(--border3); background: var(--surface3); }

.dsp-tfilter.is-active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--team-color) 88%, #fff 12%),
        var(--team-color));
    box-shadow: 0 4px 16px color-mix(in srgb, var(--team-color) 40%, transparent);
}
.dsp-tfilter.is-active b { background: rgba(255, 255, 255, .22); }

.dsp-filter-empty {
    margin: 14px 0 0;
    padding: 26px;
    border: 1px dashed var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text3);
    text-align: center;
    font-size: 14px;
}

/* =========================================================
   3. شريط «اجعل الكل مقروءاً»
   ========================================================= */

.dsp-chtools { margin-bottom: 10px; }

.dsp-markall {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-markall:hover { border-color: var(--border-primary); background: var(--surface2); }

.dsp-markall-check {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--border3);
    border-radius: 50%;
    color: transparent;
    font-size: 12px;
    transition: all var(--t-fast);
}
.dsp-markall.is-on .dsp-markall-check {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #34d399, #059669);
}

.dsp-markall-text { display: flex; flex-direction: column; gap: 2px; }
.dsp-markall-text strong { font-size: 14px; font-weight: 700; }
.dsp-markall-text small { color: var(--text3); font-size: 11.5px; }

/* =========================================================
   4. تحسينات صف الفصل
   ========================================================= */

.wt-chapters-list .chapter-item { --team-color: var(--primary-color); }
.wt-chapters-list .chapter-item[hidden] { display: none; }

.wt-chapters-list .chapter-link { position: relative; overflow: hidden; }

/* شريط لون الفريق على حافة الصف */
.wt-chapters-list .chapter-item[data-team]:not([data-team="0"]) .chapter-link::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    inset-block: 0;
    width: 3px;
    background: var(--team-color);
    opacity: .85;
}

.wt-chapters-list .chapter-number-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wt-chapters-list .chapter-title {
    color: var(--text2);
    font-size: 13px;
    font-weight: 600;
}

.wt-chapters-list .chapter-new {
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--grad-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.wt-chapters-list .chapter-subline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
    color: var(--text3);
    font-size: 12px;
}

.wt-chapters-list .chapter-ago { font-variant-numeric: tabular-nums; }

.wt-chapters-list .chapter-team {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px 2px 3px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--team-color) 16%, transparent);
    color: color-mix(in srgb, var(--team-color) 45%, var(--text));
    font-size: 11.5px;
    font-weight: 700;
}
.wt-chapters-list .chapter-team img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
.wt-chapters-list .chapter-team i { font-size: 9px; }

.wt-chapters-list .chapter-type {
    margin: 0;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--tint-08);
    color: var(--accent);
    font-size: 10.5px;
}

/* عدّادات الإعجاب والتعليقات */
.wt-chapters-list .chapter-right { gap: 6px; }

.chapter-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text3);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: all var(--t-fast);
}
.chapter-stat i { font-size: 13px; }

.chapter-stat--likes { cursor: pointer; }
.chapter-stat--likes:hover { color: var(--color-danger); background: rgba(244, 63, 94, .12); }
.chapter-stat--likes.is-liked { color: var(--color-danger); }
.chapter-stat--likes.is-busy { opacity: .5; pointer-events: none; }

.chapter-stat--comments { color: var(--text3); }
.wt-chapters-list .chapter-link:hover .chapter-stat--comments { color: var(--primary-400); }


.wt-chapters-list .read-marker {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(34, 197, 94, .16);
    color: var(--color-success);
    font-size: 10px;
    opacity: 1;
}

/* المجلدات */
.wt-chapters-list .volume-header {
    width: 100%;
    gap: 12px;
    font-family: inherit;
    transition: all var(--t-fast);
}
.wt-chapters-list .volume-header:hover { border-color: var(--border-primary); background: var(--surface3); }
.wt-chapters-list .volume-count { margin-inline-start: auto; color: var(--text3); font-size: 12px; font-weight: 600; }
.wt-chapters-list .volume-toggle { color: var(--text3); font-size: 12px; }
.dsp-chgroup[hidden] { display: none; }

.wt-chapters-list .empty-chapters { display: grid; place-items: center; gap: 10px; }
.wt-chapters-list .empty-chapters i { font-size: 30px; color: var(--text3); }

/* =========================================================
   5. تبويبات صفحة العمل
   ========================================================= */

.wt-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: none;
}
.wt-tabs::-webkit-scrollbar { display: none; }

.wt-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 11px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text2);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--t-fast);
}
.wt-tab i { font-size: 13px; opacity: .8; }

.wt-tab b {
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--tint-1);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.wt-tab:hover { color: var(--text); background: var(--tint-05); }

.wt-tab.is-active {
    color: var(--text-on-primary);
    background: var(--grad-primary);
    box-shadow: var(--shadow-primary);
}
.wt-tab.is-active i { opacity: 1; }
.wt-tab.is-active b { background: rgba(255, 255, 255, .24); }

.wt-tabpanel { display: none; animation: dsp-fade .3s var(--ease-out); }
.wt-tabpanel.is-active { display: block; }

@keyframes dsp-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.wt-tag--team {
    --team-color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-inline: 4px 10px;
    border-color: color-mix(in srgb, var(--team-color) 34%, transparent);
    background: color-mix(in srgb, var(--team-color) 12%, transparent);
}
.wt-tag--team img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.wt-tag--team b { opacity: .7; font-size: 11px; }

.wt-comments { margin-top: 24px; }

/* =========================================================
   6. شريط التفاعلات
   ========================================================= */

.dsp-reactions {
    margin: 22px 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    background-image: var(--grad-surface);
}

.dsp-reactions-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.dsp-reactions-title { font-size: 15px; font-weight: 800; color: var(--text); }
.dsp-reactions-total { color: var(--text3); font-size: 12.5px; font-weight: 600; }

.dsp-reactions-row {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
}

.dsp-reaction {
    --react-color: var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 74px;
    padding: 11px 13px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text2);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-fast);
}

.dsp-reaction-emoji { font-size: 24px; line-height: 1.1; transition: transform var(--t) var(--ease-spring); }
.dsp-reaction-count { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.dsp-reaction-label { font-size: 11px; font-weight: 600; color: var(--text3); }

.dsp-reaction:hover {
    border-color: color-mix(in srgb, var(--react-color) 50%, transparent);
    background: var(--surface3);
    transform: translateY(-3px);
}
.dsp-reaction:hover .dsp-reaction-emoji { transform: scale(1.18); }

.dsp-reaction.is-active {
    border-color: var(--react-color);
    background: color-mix(in srgb, var(--react-color) 15%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--react-color) 18%, transparent);
}
.dsp-reaction.is-active .dsp-reaction-label { color: var(--react-color); }

.dsp-reaction.is-pop .dsp-reaction-emoji { animation: dsp-pop .42s var(--ease-spring); }
@keyframes dsp-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.5) rotate(-8deg); }
    100% { transform: scale(1); }
}

.dsp-reaction.is-busy { opacity: .6; pointer-events: none; }

.dsp-reactions.is-compact { margin: 12px 0; padding: 10px; }
.dsp-reactions.is-compact .dsp-reaction { min-width: 60px; padding: 8px; }
.dsp-reactions.is-compact .dsp-reaction-label { display: none; }

/* =========================================================
   7. القارئ — مبدّل الترجمة
   ========================================================= */

.dsp-tswitch { position: relative; margin-inline-start: auto; }

.dsp-tswitch-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--text);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    max-width: 240px;
    transition: all var(--t-fast);
}
.dsp-tswitch-toggle:hover { background: var(--primary-soft2); border-color: var(--primary-color); }
.dsp-tswitch-toggle > i:first-child { color: var(--primary-400); font-size: 13px; }

.dsp-tswitch-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dsp-tswitch-count {
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    background: var(--grad-primary);
    color: var(--text-on-primary);
    font-size: 11px;
    font-weight: 800;
}

.dsp-tswitch-arrow { font-size: 10px; color: var(--text3); transition: transform var(--t); }
.dsp-tswitch-toggle[aria-expanded="true"] .dsp-tswitch-arrow { transform: rotate(180deg); }

.dsp-tswitch-menu {
    position: absolute;
    inset-block-start: calc(100% + 9px);
    inset-inline-end: 0;
    z-index: 500;
    width: min(330px, calc(100vw - 28px));
    padding: 7px;
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--t) var(--ease-out);
}
.dsp-tswitch-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }

.dsp-tswitch-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px 11px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}
.dsp-tswitch-head small { color: var(--text3); font-size: 11.5px; font-weight: 600; }

.dsp-tswitch-item {
    --team-color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: background var(--t-fast);
}
.dsp-tswitch-item:hover { background: var(--surface2); }
.dsp-tswitch-item.is-current { background: color-mix(in srgb, var(--team-color) 14%, transparent); }

.dsp-tswitch-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: color-mix(in srgb, var(--team-color) 24%, var(--surface3));
    color: var(--team-color);
    font-size: 14px;
}
.dsp-tswitch-logo img { width: 100%; height: 100%; object-fit: cover; }

.dsp-tswitch-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dsp-tswitch-info strong { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsp-tswitch-info small { color: var(--text3); font-size: 11.5px; }

.dsp-tswitch-flags { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.dsp-tswitch-badge {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--grad-primary);
    color: var(--text-on-primary);
    font-size: 10px;
    font-weight: 800;
}
.dsp-tswitch-badge.is-pref { background: var(--accent-soft); color: var(--accent); }

.dsp-tswitch-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 6px;
    padding: 11px;
    border: 1px dashed var(--border3);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text2);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-tswitch-pin:hover { color: var(--text); border-color: var(--primary-color); background: var(--primary-soft); }
.dsp-tswitch-pin.is-on { color: var(--accent); border-style: solid; border-color: var(--accent); background: var(--accent-soft); }

.ch-back-team { font-style: normal; color: var(--primary-400); font-weight: 700; }

/* =========================================================
   8. القارئ — لوحة نهاية الفصل
   ========================================================= */

.ch-endpanel {
    max-width: 780px;
    margin: 0 auto;
    padding: 26px 16px 90px;
}

.ch-end-team {
    --team-color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--team-color) 34%, transparent);
    border-radius: var(--radius);
    background: linear-gradient(135deg, color-mix(in srgb, var(--team-color) 16%, transparent), transparent 70%), var(--surface);
    color: var(--text);
    transition: all var(--t-fast);
}
.ch-end-team:hover { border-color: var(--team-color); transform: translateY(-2px); }

.ch-end-team-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    background: color-mix(in srgb, var(--team-color) 26%, var(--surface3));
    color: var(--team-color);
    font-size: 17px;
}
.ch-end-team-logo img { width: 100%; height: 100%; object-fit: cover; }

.ch-end-team-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ch-end-team-text small { color: var(--text3); font-size: 11.5px; font-weight: 600; }
.ch-end-team-text strong { font-size: 15px; font-weight: 800; }
.ch-end-team > i:last-child { color: var(--text3); font-size: 13px; }

.ch-end-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.ch-end-navbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-width: 130px;
    padding: 13px 18px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    transition: all var(--t-fast);
}
.ch-end-navbtn:hover { border-color: var(--primary-color); background: var(--surface3); }

.ch-end-navbtn--primary {
    border-color: transparent;
    background: var(--grad-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-primary);
}
.ch-end-navbtn--primary:hover { filter: brightness(1.07); transform: translateY(-2px); }

/* =========================================================
   9. دليل الفرق
   ========================================================= */

.dsp-teamsdir { padding: 28px 0 60px; }

.dsp-dir-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.dsp-dir-headtext h1 {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 7px;
    font-size: 27px;
    font-weight: 900;
}
.dsp-dir-headtext h1 i { color: var(--primary-400); font-size: 21px; }
.dsp-dir-headtext p { margin: 0; max-width: 560px; color: var(--text2); font-size: 14px; line-height: 1.8; }

.dsp-dir-tools { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

.dsp-dir-search {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 15px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
.dsp-dir-search:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.dsp-dir-search i { color: var(--text3); font-size: 13px; }
.dsp-dir-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-family: inherit; font-size: 14px; }

.dsp-dir-tools select {
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

.dsp-teamgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.dsp-teamcard {
    --team-color: var(--primary-color);
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition: all var(--t);
}
.dsp-teamcard:hover {
    border-color: color-mix(in srgb, var(--team-color) 46%, transparent);
    transform: translateY(-4px);
    box-shadow: 0 18px 40px color-mix(in srgb, var(--team-color) 18%, rgba(0,0,0,.4));
}

.dsp-teamcard-link { display: block; color: inherit; }

.dsp-teamcard-cover {
    position: relative;
    height: 92px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--team-color) 48%, transparent),
        color-mix(in srgb, var(--team-color) 12%, transparent));
}
.dsp-teamcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.dsp-teamcard-veil { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, var(--surface)); }

.dsp-teamcard-logo {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 66px;
    height: 66px;
    margin: -36px auto 0;
    border: 3px solid var(--surface);
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--team-color) 80%, #fff 20%), var(--team-color));
    color: #fff;
    font-size: 24px;
    font-weight: 900;
}
.dsp-teamcard-logo img { width: 100%; height: 100%; object-fit: cover; }

.dsp-teamcard-body { padding: 12px 16px 18px; text-align: center; }
.dsp-teamcard-body h2 { margin: 0 0 5px; font-size: 16.5px; font-weight: 800; color: var(--text); }

.dsp-teamcard-leader {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text3);
    font-size: 12px;
    font-weight: 600;
}
.dsp-teamcard-leader i { color: var(--rank-leader); font-size: 11px; }

.dsp-teamcard-desc {
    margin: 9px 0 0;
    color: var(--text2);
    font-size: 12.5px;
    line-height: 1.75;
    min-height: 38px;
}

.dsp-teamcard-stats {
    display: flex;
    justify-content: center;
    gap: 13px;
    flex-wrap: wrap;
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--border);
    color: var(--text2);
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dsp-teamcard-stats i { color: var(--text3); font-size: 11px; margin-inline-end: 3px; }

.dsp-teamcard-open {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: rgba(34, 197, 94, .14);
    color: var(--color-success);
    font-size: 11.5px;
    font-weight: 700;
}

/* =========================================================
   10. صفحة الفريق العامة
   ========================================================= */

.dsp-teampage { --team-color: var(--primary-color); }

.dsp-tp-hero { position: relative; padding: 40px 0 26px; overflow: hidden; }

.dsp-tp-bg { position: absolute; inset: 0; z-index: 0; }
.dsp-tp-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(3px); opacity: .32; transform: scale(1.08); }
.dsp-tp-bgfade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--team-color) 16%, transparent),
        var(--bg) 88%);
}

.dsp-tp-heroinner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}

.dsp-tp-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 118px;
    height: 118px;
    border: 4px solid var(--surface);
    border-radius: 26px;
    overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--team-color) 80%, #fff 20%), var(--team-color));
    color: #fff;
    font-size: 44px;
    font-weight: 900;
    box-shadow: var(--shadow-lg);
}
.dsp-tp-logo img { width: 100%; height: 100%; object-fit: cover; }

.dsp-tp-info { flex: 1; min-width: 260px; }
.dsp-tp-info h1 { margin: 0 0 10px; font-size: 30px; font-weight: 900; color: var(--text); }

.dsp-tp-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; color: var(--text2); font-size: 13.5px; }
.dsp-tp-stats strong { color: var(--text); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; margin-inline-end: 4px; }

.dsp-tp-about { max-width: 640px; margin-bottom: 16px; color: var(--text2); font-size: 14px; line-height: 1.9; }
.dsp-tp-about p { margin: 0 0 8px; }

.dsp-tp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dsp-tp-links { display: flex; gap: 8px; }

.dsp-tp-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
    padding-bottom: 60px;
}

.dsp-tp-section {
    margin-bottom: 26px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.dsp-tp-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; }
.dsp-tp-work { color: inherit; }

.dsp-tp-work-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface3);
    color: var(--text3);
    transition: transform var(--t);
}
.dsp-tp-work:hover .dsp-tp-work-cover { transform: translateY(-4px); }
.dsp-tp-work-cover img { width: 100%; height: 100%; object-fit: cover; }

.dsp-tp-work-rate {
    position: absolute;
    inset-block-start: 7px;
    inset-inline-start: 7px;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, .72);
    color: #ffc94a;                 /* على طبقة سوداء دائماً — لا يتبع الوضع الفاتح */
    font-size: 11px;
    font-weight: 800;
}

.dsp-tp-work h3 {
    margin: 8px 0 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text2);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dsp-tp-work:hover h3 { color: var(--text); }

.dsp-tp-chapters { display: flex; flex-direction: column; gap: 7px; }

.dsp-tp-ch {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: inherit;
    transition: all var(--t-fast);
}
.dsp-tp-ch:hover { border-color: var(--primary-color); background: var(--surface3); }

.dsp-tp-ch-thumb {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: var(--surface3);
    color: var(--text3);
}
.dsp-tp-ch-thumb img { width: 100%; height: 100%; object-fit: cover; }

.dsp-tp-ch-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dsp-tp-ch-body strong { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsp-tp-ch-body span { color: var(--text3); font-size: 12px; }
.dsp-tp-ch-ago { flex-shrink: 0; color: var(--text3); font-size: 11.5px; }

.dsp-tp-members { display: flex; flex-direction: column; gap: 9px; }

.dsp-tp-member {
    --rank-color: var(--text2);
    display: flex;
    align-items: center;
    gap: 11px;
}

.dsp-tp-member-av { position: relative; flex-shrink: 0; }
.dsp-tp-member-av img { width: 42px; height: 42px; border-radius: 50%; display: block; }

.dsp-tp-member-badge {
    position: absolute;
    inset-block-end: -2px;
    inset-inline-end: -2px;
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--rank-color);
    color: #fff;
    font-size: 8px;
}

.dsp-tp-member-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dsp-tp-member-info strong { font-size: 13.5px; font-weight: 700; color: var(--text); }
.dsp-tp-member-info span { font-size: 11.5px; font-weight: 700; color: var(--rank-color); }

/* =========================================================
   11. لوحة الفريق
   ========================================================= */

.dsp-dash { min-height: 60vh; padding-bottom: 60px; }

.dsp-dash-gate, .dsp-dash-empty { display: grid; place-items: center; padding: 70px 20px; text-align: center; }

.dsp-gate-card {
    max-width: 460px;
    padding: 38px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.dsp-gate-icon, .dsp-empty-icon { font-size: 42px; color: var(--primary-400); margin-bottom: 16px; }
.dsp-dash-gate h1, .dsp-dash-empty h1 { margin: 0 0 10px; font-size: 23px; font-weight: 900; }
.dsp-dash-gate p, .dsp-dash-empty p { margin: 0 0 22px; color: var(--text2); font-size: 14px; line-height: 1.8; max-width: 440px; }
.dsp-gate-actions { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }

/* الدعوات */
.dsp-invites { margin: 22px 0; padding: 18px; border: 1px solid var(--border-primary); border-radius: var(--radius); background: linear-gradient(135deg, var(--primary-soft), transparent 65%), var(--surface); }
.dsp-invites-title { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 16px; font-weight: 800; }
.dsp-invites-title i { color: var(--primary-400); }
.dsp-invites-list { display: flex; flex-direction: column; gap: 10px; }

.dsp-invite-card {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    transition: opacity var(--t);
}

.dsp-invite-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--grad-primary);
    color: var(--text-on-primary);
    font-size: 17px;
    font-weight: 900;
}
.dsp-invite-logo img { width: 100%; height: 100%; object-fit: cover; }

.dsp-invite-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dsp-invite-body strong { font-size: 14.5px; font-weight: 800; }
.dsp-invite-body span { color: var(--text3); font-size: 12.5px; }
.dsp-invite-body b { color: var(--primary-400); }
.dsp-invite-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ترويسة اللوحة */
.dsp-dash-head {
    --team-color: var(--primary-color);
    position: relative;
    padding: 30px 0 22px;
    margin-bottom: 24px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.dsp-dash-banner { position: absolute; inset: 0; }
.dsp-dash-banner img { width: 100%; height: 100%; object-fit: cover; opacity: .22; filter: blur(2px); }
.dsp-dash-head::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--team-color) 14%, transparent), var(--bg) 92%);
}

.dsp-dash-head-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.dsp-dash-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }

.dsp-dash-logo {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 74px;
    height: 74px;
    border: 3px solid var(--surface);
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--team-color) 80%, #fff 20%), var(--team-color));
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    box-shadow: var(--shadow);
}
.dsp-dash-logo img { width: 100%; height: 100%; object-fit: cover; }

.dsp-dash-meta h1 { margin: 0 0 7px; font-size: 24px; font-weight: 900; }
.dsp-dash-subrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.dsp-rank-chip {
    --rank-color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 1px solid color-mix(in srgb, var(--rank-color) 42%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--rank-color) 14%, transparent);
    color: var(--rank-color);
    font-size: 12px;
    font-weight: 800;
}

.dsp-dash-public { display: inline-flex; align-items: center; gap: 6px; color: var(--text3); font-size: 12.5px; font-weight: 600; }
.dsp-dash-public:hover { color: var(--primary-400); }

.dsp-dash-pending {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: var(--radius-pill);
    background: rgba(245, 158, 11, .14);
    color: var(--color-warn);
    font-size: 12px;
    font-weight: 700;
}

.dsp-dash-headtools { display: flex; align-items: center; gap: 10px; }

.dsp-team-switch {
    height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}

/* بطاقات الإحصائيات */
.dsp-statgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.dsp-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.dsp-stat::after {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    height: 2px;
    background: var(--grad-accent);
    opacity: .8;
}
.dsp-stat--b::after { background: linear-gradient(90deg, var(--rank-proofreader), var(--color-webtoon)); }
.dsp-stat--c::after { background: linear-gradient(90deg, var(--color-success), var(--accent-2)); }
.dsp-stat--d::after { background: linear-gradient(90deg, var(--accent), var(--primary-color)); }

.dsp-stat-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary-400);
    font-size: 15px;
}
.dsp-stat--b .dsp-stat-icon { background: rgba(185, 140, 240, .14); color: var(--rank-proofreader); }
.dsp-stat--c .dsp-stat-icon { background: rgba(62, 196, 109, .14);  color: var(--color-success); }
.dsp-stat--d .dsp-stat-icon { background: var(--accent-soft);        color: var(--accent); }

.dsp-stat-value { font-size: 26px; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.dsp-stat-label { color: var(--text3); font-size: 12.5px; font-weight: 600; }

/* تبويبات اللوحة */
.dsp-dash-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: none;
}
.dsp-dash-tabs::-webkit-scrollbar { display: none; }

.dsp-dtab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 11px 17px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text2);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--t-fast);
}
.dsp-dtab i { font-size: 13px; opacity: .8; }
.dsp-dtab:hover { color: var(--text); background: var(--tint-05); }
.dsp-dtab.is-active { color: var(--text-on-primary); background: var(--grad-primary); box-shadow: var(--shadow-primary); }

.dsp-dtab-badge {
    display: grid;
    place-items: center;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-danger);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
}

.dsp-dpanel { display: none; animation: dsp-fade .3s var(--ease-out); }
.dsp-dpanel.is-active { display: block; }

.dsp-panel-intro { margin: 0 0 18px; color: var(--text2); font-size: 13.5px; line-height: 1.85; }

.dsp-dash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dsp-dash-count { color: var(--text3); font-size: 13px; font-weight: 700; }

/* جدول فصول الفريق */
.dsp-chaptable { display: flex; flex-direction: column; gap: 7px; }

.dsp-chaprow {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: all var(--t-fast);
}
.dsp-chaprow:hover { border-color: var(--border-primary); background: var(--surface2); }

.dsp-chaprow-thumb {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: var(--surface3);
    color: var(--text3);
}
.dsp-chaprow-thumb img { width: 100%; height: 100%; object-fit: cover; }

.dsp-chaprow-main { flex: 1; min-width: 0; }
.dsp-chaprow-title { display: block; color: var(--text); font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsp-chaprow-title span { color: var(--primary-400); }
.dsp-chaprow-title:hover { color: var(--primary-400); }

.dsp-chaprow-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; color: var(--text3); font-size: 12px; }
.dsp-chaprow-meta i { margin-inline-end: 4px; font-size: 10.5px; }

.dsp-chaprow-actions { display: flex; gap: 7px; flex-shrink: 0; }

.dsp-dash-pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }

.dsp-pagebtn {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text2);
    font-size: 13px;
    font-weight: 700;
    transition: all var(--t-fast);
}
.dsp-pagebtn:hover { color: var(--text); border-color: var(--primary-color); }
.dsp-pagebtn.is-active { color: var(--text-on-primary); background: var(--grad-primary); border-color: transparent; }

/* النشر */
.dsp-pubgrid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 26px; align-items: start; }
.dsp-pubcol { min-width: 0; }

.dsp-worksearch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 44px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
}
.dsp-worksearch:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.dsp-worksearch i { color: var(--text3); font-size: 13px; }
.dsp-worksearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-family: inherit; font-size: 14px; }

.dsp-worksearch-results { display: flex; flex-direction: column; gap: 4px; margin-top: 7px; max-height: 260px; overflow-y: auto; }

.dsp-ws-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: start;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-ws-item:hover { border-color: var(--primary-color); background: var(--primary-soft); }
.dsp-ws-item img, .dsp-ws-ph { width: 32px; height: 44px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.dsp-ws-ph { display: grid; place-items: center; background: var(--surface3); color: var(--text3); font-size: 12px; }

.dsp-ws-loading, .dsp-ws-empty { padding: 12px; color: var(--text3); font-size: 13px; text-align: center; }

.dsp-work-chosen {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 9px;
    padding: 10px 13px;
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
}
.dsp-work-chosen img { width: 34px; height: 46px; border-radius: 4px; object-fit: cover; }
.dsp-work-chosen span { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); }
.dsp-work-chosen button { border: 0; background: none; color: var(--text3); cursor: pointer; font-size: 14px; }
.dsp-work-chosen button:hover { color: var(--color-danger); }

/* منطقة الإفلات */
.dsp-dropzone {
    display: grid;
    place-items: center;
    gap: 7px;
    padding: 40px 20px;
    border: 2px dashed var(--border3);
    border-radius: var(--radius);
    background: var(--surface2);
    text-align: center;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-dropzone:hover, .dsp-dropzone.is-over {
    border-color: var(--primary-color);
    background: var(--primary-soft);
}
.dsp-dropzone i { font-size: 32px; color: var(--primary-400); }
.dsp-dropzone strong { font-size: 14.5px; font-weight: 700; color: var(--text); }
.dsp-dropzone small { color: var(--text3); font-size: 12px; }

.dsp-upload-status { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.dsp-progress { flex: 1; height: 6px; border-radius: var(--radius-pill); background: var(--surface3); overflow: hidden; }
.dsp-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad-accent); transition: width .3s var(--ease-out); }
.dsp-upload-text { flex-shrink: 0; color: var(--text3); font-size: 12px; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dsp-pagegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.dsp-page {
    position: relative;
    aspect-ratio: 2 / 3;
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: var(--surface3);
    cursor: grab;
}
.dsp-page.is-dragging { opacity: .4; }
.dsp-page img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dsp-page-num {
    position: absolute;
    inset-block-start: 4px;
    inset-inline-start: 4px;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, .76);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.dsp-page-del {
    position: absolute;
    inset-block-start: 4px;
    inset-inline-end: 4px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .66);
    color: #fff;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: all var(--t-fast);
}
.dsp-page:hover .dsp-page-del { opacity: 1; }
.dsp-page-del:hover { background: var(--color-danger); }

.dsp-publish-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.dsp-publish-hint { color: var(--text3); font-size: 12.5px; }
.dsp-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* الأعضاء */
.dsp-invitebox { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dsp-invitebox input {
    flex: 1;
    min-width: 200px;
    padding: 11px 14px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
}
.dsp-invitebox input:focus { outline: 0; border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-soft); }
.dsp-invitebox select {
    padding: 11px 13px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.dsp-pending-invites { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.dsp-pending-label { color: var(--text3); font-size: 12.5px; font-weight: 700; }

.dsp-pending-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px 5px 12px;
    border: 1px dashed var(--border3);
    border-radius: var(--radius-pill);
    color: var(--text2);
    font-size: 12.5px;
    font-weight: 700;
}
.dsp-pending-chip small { color: var(--text3); font-weight: 600; }
.dsp-pending-chip button { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--surface3); color: var(--text3); font-size: 9px; cursor: pointer; }
.dsp-pending-chip button:hover { background: var(--color-danger); color: #fff; }

.dsp-reqlist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }

.dsp-reqcard {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    border: 1px solid var(--color-warn);
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, .07);
    transition: opacity var(--t);
}
.dsp-reqcard-av { border-radius: 50%; flex-shrink: 0; }
.dsp-reqcard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dsp-reqcard-body strong { font-size: 14px; font-weight: 800; }
.dsp-reqcard-body span { color: var(--text3); font-size: 12px; }
.dsp-reqcard-note { margin: 5px 0 0; color: var(--text2); font-size: 12.5px; line-height: 1.7; }
.dsp-reqcard-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.dsp-memberlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }

.dsp-membercard {
    --rank-color: var(--text2);
    display: flex;
    align-items: center;
    gap: 13px;
    flex-wrap: wrap;
    padding: 14px;
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--rank-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: all var(--t);
}
.dsp-membercard:hover { background: var(--surface2); }

.dsp-membercard-av { position: relative; flex-shrink: 0; }
.dsp-membercard-av img { width: 52px; height: 52px; border-radius: 50%; display: block; }

.dsp-membercard-crown {
    position: absolute;
    inset-block-end: -2px;
    inset-inline-end: -2px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--rank-color);
    color: #fff;
    font-size: 9px;
}

.dsp-membercard-body { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dsp-membercard-body strong { font-size: 14.5px; font-weight: 800; color: var(--text); }
.dsp-membercard-rank { font-size: 12px; font-weight: 700; color: var(--rank-color); }
.dsp-membercard-title { font-size: 11.5px; color: var(--text2); }
.dsp-membercard-since { color: var(--text3); font-size: 11px; white-space: nowrap; }

.dsp-membercard-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    margin-inline-start: auto;
}
.dsp-membercard-actions .dsp-mini-select { max-width: 128px; }

/* عند ضيق البطاقة تنزل الأدوات لسطر مستقل */
@media (max-width: 1180px) {
    .dsp-membercard-actions { flex-basis: 100%; margin-inline-start: 0; justify-content: flex-end; }
}

.dsp-danger-zone { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }

/* جدول الصلاحيات */
.dsp-permtable-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

.dsp-permtable { width: 100%; border-collapse: collapse; min-width: 720px; }

.dsp-permtable th, .dsp-permtable td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: center; }
.dsp-permtable thead th { --rank-color: var(--text2); background: var(--surface2); }

.dsp-permtable thead th i { display: block; margin-bottom: 5px; color: var(--rank-color); font-size: 14px; }
.dsp-permtable thead th span { font-size: 11.5px; font-weight: 700; color: var(--rank-color); }
.dsp-permtable thead th { border-bottom: 2px solid color-mix(in srgb, var(--rank-color) 40%, transparent); }
.dsp-permtable thead th:first-child { text-align: start; font-size: 12.5px; font-weight: 800; color: var(--text); }

.dsp-permtable-cap { display: flex; align-items: center; gap: 11px; text-align: start; min-width: 230px; }
.dsp-permtable-cap > i { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-xs); background: var(--surface3); color: var(--text2); font-size: 13px; flex-shrink: 0; }
.dsp-permtable-cap span { display: flex; flex-direction: column; gap: 2px; }
.dsp-permtable-cap strong { font-size: 13.5px; font-weight: 700; color: var(--text); }
.dsp-permtable-cap small { font-size: 11.5px; color: var(--text3); line-height: 1.6; }

.dsp-permtable td.is-yes { --rank-color: var(--primary-color); }
.dsp-permtable td.is-yes i { color: var(--rank-color); font-size: 14px; }
.dsp-permtable td.is-no i { color: var(--text3); opacity: .35; font-size: 12px; }
.dsp-permtable tbody tr:hover td { background: var(--tint-03); }

/* الإعدادات */
.dsp-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dsp-settings-save { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }

.dsp-mediarow { display: flex; align-items: center; gap: 12px; }

.dsp-mediaprev {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface2);
    color: var(--text3);
    font-size: 17px;
}
.dsp-mediaprev--wide { width: 110px; }
.dsp-mediaprev img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   12. استجابة
   ========================================================= */

@media (max-width: 1000px) {
    .dsp-tp-body { grid-template-columns: 1fr; }
    .dsp-pubgrid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 780px) {
    .dsp-settings-grid { grid-template-columns: 1fr; }
    .dsp-field-row { grid-template-columns: 1fr; }
    .dsp-memberlist { grid-template-columns: 1fr; }

    .dsp-tfilter-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .dsp-tfilter-chips { overflow-x: auto; }

    .dsp-dash-head-inner { flex-direction: column; align-items: flex-start; }
    .dsp-dash-identity { gap: 13px; }
    .dsp-dash-logo { width: 60px; height: 60px; font-size: 23px; }
    .dsp-dash-meta h1 { font-size: 20px; }

    .dsp-tp-logo { width: 88px; height: 88px; font-size: 33px; }
    .dsp-tp-info h1 { font-size: 23px; }

    .dsp-reaction { min-width: 0; flex: 1; padding: 9px 6px; }
    .dsp-reaction-label { display: none; }
    .dsp-reaction-emoji { font-size: 21px; }

    .dsp-invite-card, .dsp-reqcard { flex-wrap: wrap; }
    .dsp-invite-actions, .dsp-reqcard-actions { width: 100%; }

    .dsp-chaprow-meta { gap: 10px; }

    .wt-chapters-list .chapter-list-content { gap: 9px; padding: 11px 12px; }
    .wt-chapters-list .chapter-right { gap: 3px; }
    .chapter-stat { padding: 5px 7px; font-size: 11.5px; }
    .chapter-stat i { font-size: 12px; }
}

@media (max-width: 520px) {
    .dsp-teamgrid { grid-template-columns: 1fr; }
    .dsp-statgrid { grid-template-columns: 1fr 1fr; }
    .dsp-stat { padding: 14px; }
    .dsp-stat-value { font-size: 21px; }
    .dsp-pagegrid { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
    .wt-tab { padding: 10px 13px; font-size: 13px; }
    .wt-chapters-list .chapter-subline { gap: 7px; font-size: 11px; }
}

/* خط الرموز التعبيرية — يضمن عرضها ملوّنة على كل الأنظمة */
.dsp-reaction-emoji {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji',
                 'Twemoji Mozilla', 'EmojiOne Color', sans-serif;
}

/* =========================================================
   Despair 3.1 — استوديو الفريق وبوابة الطلبات
   ========================================================= */

/* ---------- بوابة الصلاحيات ---------- */
.dspq-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 620px;
    margin: 22px auto;
    padding: 30px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(600px 180px at 50% 0, var(--primary-soft), transparent 70%),
        var(--surface);
}

.dspq-gate--ok   { border-color: rgba(62,196,109,.32); }
.dspq-gate--wait { border-color: rgba(242,177,52,.32); }

.dspq-gate-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: var(--radius-lg);
    background: var(--primary-soft);
    color: var(--primary-400);
    font-size: 24px;
}
.dspq-gate--ok .dspq-gate-icon   { background: rgba(62,196,109,.14); color: var(--color-success); }
.dspq-gate--wait .dspq-gate-icon { background: rgba(242,177,52,.14); color: var(--color-warn); }

.dspq-gate h2 { margin: 0; font-size: 19px; font-weight: 900; }
.dspq-gate p  { margin: 0; color: var(--text2); font-size: 13.5px; line-height: 1.9; max-width: 480px; }

.dspq-lastnote {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(224,72,77,.3);
    border-radius: var(--radius);
    background: rgba(224,72,77,.08);
    color: var(--text2);
    font-size: 12.5px;
    text-align: start;
}
.dspq-lastnote i { color: var(--color-danger); }
.dspq-lastnote span { color: var(--text3); }

.dspq-modal-hint {
    margin: 0 0 14px;
    padding: 11px 14px;
    border-inline-start: 3px solid var(--primary-color);
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--text2);
    font-size: 12.5px;
    line-height: 1.8;
}

/* ---------- تبويبات مصدر الرفع ---------- */
.dsp-srctabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
}

.dsp-srctab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text3);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-srctab:hover { color: var(--text2); }
.dsp-srctab.is-active { background: var(--grad-primary); color: var(--text-on-primary); box-shadow: var(--shadow-primary); }

/* ---------- معلومات ملف ZIP ---------- */
.dsp-zipinfo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--text);
    font-size: 13.5px;
}
.dsp-zipinfo i { color: var(--primary-400); }
.dsp-zipinfo button {
    margin-inline-start: auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: var(--tint-1);
    color: var(--text2);
    cursor: pointer;
}
.dsp-zipinfo button:hover { background: var(--color-danger); color: #fff; }

/* ---------- ملاحظة المعالجة ---------- */
.dsp-procnote {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 14px;
    padding: 13px 15px;
    border: 1px dashed var(--border2);
    border-radius: var(--radius);
    color: var(--text3);
    font-size: 12.5px;
    line-height: 1.85;
}
.dsp-procnote i { color: var(--accent); font-size: 15px; margin-top: 2px; }

.dsp-pagegrid-tools { display: flex; justify-content: flex-end; margin: 10px 0 6px; }

/* ---------- سجلّ الرفع ---------- */
.dsp-uplog {
    max-height: 190px;
    margin-top: 12px;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    font-size: 12.5px;
    line-height: 1.8;
}
.dsp-uplog:empty { display: none; }

.dsp-uplog-line {
    padding: 5px 8px;
    border-radius: 5px;
    color: var(--text2);
}
.dsp-uplog-line + .dsp-uplog-line { margin-top: 3px; }
.dsp-uplog-line.is-ok   { background: rgba(62,196,109,.10); color: var(--color-success); }
.dsp-uplog-line.is-err  { background: rgba(224,72,77,.10);  color: var(--color-danger); }
.dsp-uplog-line.is-warn { background: rgba(242,177,52,.10); color: var(--color-warn); }
.dsp-uplog-line a { color: inherit; text-decoration: underline; }

/* ---------- خطة الفصول ---------- */
.dsp-planhead,
.dsp-planrow {
    display: grid;
    grid-template-columns: minmax(0,1.5fr) 82px 110px minmax(0,1.3fr);
    gap: 10px;
    align-items: center;
}

.dsp-planhead {
    padding: 0 10px 8px;
    color: var(--text3);
    font-size: 11.5px;
    font-weight: 800;
}

.dsp-planlist { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }

.dsp-planrow {
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
}

.dsp-planrow-src {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}
.dsp-planrow-imgs { color: var(--text3); font-size: 12px; }

.dsp-planrow input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-xs);
    background: var(--bg-deep);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}
.dsp-planrow input:focus { outline: 0; border-color: var(--primary-color); }

@media (max-width: 680px) {
    .dsp-planhead { display: none; }
    .dsp-planrow { grid-template-columns: 1fr 1fr; }
    .dsp-planrow-src { grid-column: 1 / -1; }
}

/* ---------- نافذة عريضة ---------- */
.dsp-modal-box--wide { max-width: 880px; }

.dsp-nw-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; }
.dsp-nw-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

@media (max-width: 760px) {
    .dsp-nw-grid { grid-template-columns: 1fr; gap: 16px; }
}

.dsp-field-hint {
    display: block;
    margin-top: 5px;
    color: var(--text3);
    font-size: 11.5px;
    line-height: 1.7;
}

.dsp-checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--text2);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.dsp-checkline input { width: 17px; height: 17px; accent-color: var(--primary-color); }

/* غلاف */
.dsp-coverpick { display: flex; gap: 14px; align-items: flex-start; }
.dsp-coverpick-actions { display: flex; flex-direction: column; gap: 8px; }
.dsp-mediaprev--cover {
    width: 104px;
    height: 148px;
    border-radius: var(--radius-poster-sm);
    flex-shrink: 0;
}
.dsp-mediaprev--cover img { width: 100%; height: 100%; object-fit: cover; }

/* صندوق التصنيفات */
.dsp-genre-search {
    width: 100%;
    margin-bottom: 8px;
    padding: 9px 12px;
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

.dsp-genrebox {
    max-height: 230px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-deep);
}

.dsp-genrebox label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface2);
    color: var(--text2);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-fast);
}
.dsp-genrebox label:hover { border-color: var(--border-primary); color: var(--text); }
.dsp-genrebox input { accent-color: var(--primary-color); }
.dsp-genrebox label:has(input:checked) {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    color: var(--text);
}

/* =========================================================
   3.1 — تحسينات الجوال للوحة الفريق والنوافذ
   ========================================================= */
@media (max-width: 620px) {
    /* النوافذ تتحوّل لألواح سفلية على الجوال */
    .dsp-modal { place-items: end stretch; padding: 0; }

    .dsp-modal-box,
    .dsp-modal-box--wide {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-bottom: 0;
        transform: translateY(100%);
    }
    .dsp-modal.is-open .dsp-modal-box { transform: translateY(0); }

    .dsp-modal-head { padding: 16px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
    .dsp-modal-body { padding: 16px; }
    .dsp-modal-foot {
        position: sticky;
        bottom: 0;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 2;
    }
    .dsp-modal-foot .dsp-btn { flex: 1; }

    /* استوديو الفريق */
    .dsp-srctab { font-size: 12.5px; padding: 9px 6px; }
    .dsp-srctab i { font-size: 13px; }
    .dsp-dropzone { padding: 26px 14px; }
    .dsp-dropzone i { font-size: 26px; }
    .dsp-dropzone strong { font-size: 13.5px; }
    .dsp-dropzone small { font-size: 11px; line-height: 1.7; }

    .dsp-publish-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .dsp-publish-bar .dsp-btn { width: 100%; }
    .dsp-publish-hint { text-align: center; }

    .dsp-uplog { max-height: 150px; font-size: 11.5px; }

    /* بطاقات الأعضاء والطلبات */
    .dsp-membercard,
    .dsp-reqcard { flex-wrap: wrap; }
    .dsp-membercard-actions,
    .dsp-reqcard-actions { width: 100%; justify-content: flex-end; }

    .dsp-invitebox { flex-direction: column; align-items: stretch; }
    .dsp-invitebox .dsp-btn { width: 100%; }

    /* التصنيفات */
    .dsp-genrebox { max-height: 180px; }

    /* الغلاف */
    .dsp-coverpick { flex-direction: column; align-items: center; }
    .dsp-coverpick-actions { width: 100%; }
    .dsp-coverpick-actions .dsp-btn { width: 100%; justify-content: center; }

    /* البوابة */
    .dspq-gate { padding: 24px 16px; margin: 16px 0; }
    .dspq-gate h2 { font-size: 17px; }
    .dspq-gate .dsp-btn { width: 100%; }
}

/* جدول الصلاحيات يتمرّر أفقياً بدل كسر الصفحة */
.dsp-permtable-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dsp-permtable { min-width: 680px; }

/* الألواح المتبدّلة داخل استوديو الفريق */
.dsp-srcpane[hidden] { display: none !important; }
.dsp-srcpane { display: block; }
