:root {
    --bg:         #0c0d11;
    --surface:    #14161e;
    --surface-2:  #1e2130;
    --border:     #2a2d3e;
    --gold:       #c9a84c;
    --gold-light: #e8c97a;
    --text:       #ddd8c7;
    --muted:      #7a7670;
    --white:      #f0ece0;
    --danger:     #c94c4c;
    --success:    #4ca87e;
    --font-ur:    'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
    --font-en:    'EB Garamond', Garamond, 'Times New Roman', serif;
    --font-ui:    'Segoe UI', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-en);
    font-size: 18px;
    line-height: 1.7;
    min-height: 100vh;
}
.container { max-width: 1000px; margin: 0 auto; padding: 0 2rem; }
.hidden { display: none !important; }

/* ── Header ────────────────────────────────────────────────────────────── */
header {
    text-align: center;
    padding: 5rem 2rem 4rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}
header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.title-ur {
    font-family: var(--font-ur);
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 700;
    color: var(--gold);
    direction: rtl;
    line-height: 2;
    text-shadow: 0 0 40px rgba(201,168,76,0.25);
}
.subtitle-ur {
    font-family: var(--font-ur);
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: var(--muted);
    direction: rtl;
    margin-top: 1.75rem;
    line-height: 2;
}
.title-en {
    font-family: var(--font-en);
    font-size: clamp(0.85rem, 2.5vw, 1.1rem);
    color: var(--muted);
    letter-spacing: 0.25rem;
    text-transform: uppercase;
    margin-top: 1rem;
    direction: ltr;
}

/* ── Ornament ──────────────────────────────────────────────────────────── */
.ornament {
    text-align: center;
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 1.2rem;
    margin: 3.5rem 0;
    opacity: 0.5;
}
.ornament::before { content: '✦  ✦  ✦'; }

/* ── Section head ──────────────────────────────────────────────────────── */
.section-head { text-align: center; margin-bottom: 2.5rem; }
.section-head h2 {
    font-family: var(--font-ur);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--gold);
    direction: rtl;
}
.en-label {
    font-family: var(--font-en);
    font-style: italic;
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.1rem;
}

/* ── Biography ─────────────────────────────────────────────────────────── */
#biography { padding: 5rem 0; }
.bio-text {
    font-family: var(--font-ur);
    font-size: 1.2rem;
    direction: rtl;
    text-align: right;
    max-width: 720px;
    margin: 0 auto;
    line-height: 2.5;
    color: var(--text);
}
.bio-text p + p { margin-top: 1.5rem; }

/* ── Books ─────────────────────────────────────────────────────────────── */
#books { padding: 5rem 0; background: var(--surface); }
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}
.book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: 3px solid var(--gold);
    padding: 2rem;
    text-align: center;
    transition: transform .2s, box-shadow .2s;
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(201,168,76,0.1);
}
.book-year {
    font-family: var(--font-en);
    font-size: 0.85rem;
    letter-spacing: 0.3rem;
    color: var(--muted);
    margin-bottom: 1rem;
}
.book-title-ur {
    font-family: var(--font-ur);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--white);
    direction: rtl;
    line-height: 1.5;
}
.book-title-en {
    font-family: var(--font-en);
    font-style: italic;
    color: var(--muted);
    font-size: 0.95rem;
    margin-top: 0.5rem;
}
.book-badge {
    display: inline-block;
    margin-top: 1.2rem;
    padding: 0.2rem 1rem;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.75rem;
    font-family: var(--font-ur);
    direction: rtl;
}
.book-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: auto;
    width: 100%;
}
.book-pdf-btn {
    display: inline-block;
    padding: 0.35rem 1.1rem;
    min-width: 9rem;
    border: 1px solid var(--gold);
    color: var(--gold);
    background: transparent;
    font-size: 0.8rem;
    font-family: var(--font-ur);
    direction: rtl;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.book-pdf-btn:hover {
    background: var(--gold);
    color: var(--bg);
}
.book-comments-btn {
    display: inline-block;
    padding: 0.35rem 1.1rem;
    min-width: 9rem;
    border: 1px solid var(--border);
    color: var(--muted);
    background: transparent;
    font-size: 0.8rem;
    font-family: var(--font-ur);
    direction: rtl;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.book-comments-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ── Photo Gallery (public page) ───────────────────────────────────────── */
#gallery { padding: 5rem 0; }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}
.gallery-item {
    cursor: pointer;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform .2s, box-shadow .2s;
    background: var(--surface);
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    border-color: var(--gold);
}
.gallery-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-caption {
    font-family: var(--font-ur);
    font-size: 0.9rem;
    direction: rtl;
    text-align: right;
    color: var(--muted);
    padding: 0.6rem 0.85rem;
    border-top: 1px solid var(--border);
    line-height: 1.8;
}

/* ── Voice & Video (public page) ───────────────────────────────────────── */
#media { padding: 5rem 0; background: var(--surface); }
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.media-card {
    background: var(--bg);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.media-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
.media-embed-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}
.media-embed-wrap img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.85;
    transition: opacity .2s;
}
.media-embed-wrap:hover img { opacity: 1; }
.media-embed-wrap iframe {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: none;
}
.media-play {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 3.2rem; height: 3.2rem;
    display: flex; align-items: center; justify-content: center;
    background: rgba(201,168,76,0.9);
    color: var(--bg);
    border-radius: 50%;
    font-size: 1.1rem;
    padding-left: 0.15rem;
}
.media-card-body { padding: 1rem 1.1rem 1.25rem; }
.media-badge {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 0.7rem;
    font-family: var(--font-ur);
    direction: rtl;
    margin-bottom: 0.6rem;
}
.media-title {
    font-family: var(--font-ur);
    font-size: 1.15rem;
    color: var(--white);
    direction: rtl;
    line-height: 1.8;
}
.media-desc {
    font-family: var(--font-ur);
    font-size: 0.9rem;
    color: var(--muted);
    direction: rtl;
    line-height: 1.9;
    margin-top: 0.4rem;
}

/* ── Comments modal (public page) ──────────────────────────────────────── */
#comments-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.comments-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--gold);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
}
.comments-box h3 {
    font-family: var(--font-ur);
    font-size: 1.5rem;
    color: var(--gold);
    direction: rtl;
    text-align: center;
    margin-bottom: 1.5rem;
}
#comments-list { margin-bottom: 1.5rem; }
.comment-item {
    border-bottom: 1px solid var(--border);
    padding: 0.9rem 0;
}
.comment-item:first-child { padding-top: 0; }
.comment-item-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    direction: rtl;
    margin-bottom: 0.3rem;
}
.comment-author {
    font-family: var(--font-ur);
    color: var(--gold);
    font-size: 0.95rem;
}
.comment-date {
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: 0.75rem;
    direction: ltr;
}
.comment-body {
    font-family: var(--font-ur);
    color: var(--text);
    direction: rtl;
    text-align: right;
    line-height: 2;
    font-size: 0.95rem;
}
.comments-empty, .comments-loading {
    font-family: var(--font-ur);
    color: var(--muted);
    direction: rtl;
    text-align: center;
    padding: 1rem 0;
}
#comments-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
#comments-form input[type="text"],
#comments-form textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.65rem 1rem;
    font-family: var(--font-ur);
    direction: rtl;
    font-size: 0.95rem;
    outline: none;
    transition: border-color .2s;
}
#comments-form input[type="text"]:focus,
#comments-form textarea:focus { border-color: var(--gold); }
#comments-form textarea { resize: vertical; }
.hp-field { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.comment-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    direction: ltr;
}
.comment-status {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--muted);
}
#comments-close {
    position: fixed;
    top: 1.25rem; right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color .2s;
    z-index: 9001;
}
#comments-close:hover { color: var(--white); }

/* ── Lightbox ──────────────────────────────────────────────────────────── */
#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.93);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}
#lightbox img {
    max-width: min(90vw, 900px);
    max-height: 78vh;
    object-fit: contain;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
#lb-caption {
    font-family: var(--font-ur);
    direction: rtl;
    color: var(--text);
    font-size: 1rem;
    text-align: center;
}
#lb-counter {
    font-family: var(--font-ui);
    color: var(--muted);
    font-size: 0.8rem;
    direction: ltr;
}
#lb-close {
    position: fixed;
    top: 1.25rem; right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color .2s;
    z-index: 9001;
}
#lb-close:hover { color: var(--white); }
.lb-nav {
    position: fixed;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background .2s;
    z-index: 9001;
    line-height: 1;
}
.lb-nav:hover { background: rgba(255,255,255,0.15); }
#lb-prev { left: 1rem; }
#lb-next { right: 1rem; }

/* ── PDF viewer modal ──────────────────────────────────────────────────── */
#pdf-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.93);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem 1rem;
}
#pdf-frame {
    width: 100%;
    max-width: 900px;
    height: 100%;
    border: none;
    background: var(--white);
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
#pdf-close {
    position: fixed;
    top: 1.25rem; right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color .2s;
    z-index: 9001;
}
#pdf-close:hover { color: var(--white); }

/* ── Archive project ───────────────────────────────────────────────────── */
#archive { padding: 5rem 0; }
.archive-text {
    font-family: var(--font-ur);
    font-size: 1.1rem;
    direction: rtl;
    text-align: right;
    max-width: 700px;
    margin: 0 auto;
    line-height: 2.5;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-ur);
    font-size: 1rem;
    direction: rtl;
    position: relative;
}
.admin-link {
    position: absolute;
    bottom: 1.2rem;
    left: 1.5rem;
    color: var(--border);
    text-decoration: none;
    font-size: 0.65rem;
    font-family: var(--font-ui);
    transition: color .2s;
    user-select: none;
}
.admin-link:hover { color: var(--muted); }

/* ── Password gate ─────────────────────────────────────────────────────── */
.password-gate {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.gate-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--gold);
    padding: 3rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
}
.gate-title-ur {
    font-family: var(--font-ur);
    font-size: 1.8rem;
    color: var(--gold);
    direction: rtl;
    margin-bottom: 0.3rem;
}
.gate-title-en {
    font-family: var(--font-en);
    font-style: italic;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    direction: ltr;
}
.gate-box input[type="password"] {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.85rem 1.2rem;
    font-size: 1rem;
    font-family: var(--font-ui);
    margin-bottom: 1rem;
    outline: none;
    transition: border-color .2s;
}
.gate-box input[type="password"]:focus { border-color: var(--gold); }
.gate-error {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.4rem;
    font-family: var(--font-ui);
    display: none;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.75rem;
    font-family: var(--font-en);
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn-gold   { background: var(--gold); color: var(--bg); font-weight: 600; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn-outline:hover { background: rgba(201,168,76,0.08); }
.btn-ghost  { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }
.btn-danger { background: var(--danger); color: white; border: none; }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.875rem; }

/* ── Admin nav ─────────────────────────────────────────────────────────── */
.admin-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
    flex-wrap: wrap;
}
.admin-title {
    font-family: var(--font-ur);
    font-size: 1.2rem;
    color: var(--gold);
    direction: rtl;
}
.admin-nav-btns { display: flex; gap: 0.5rem; direction: ltr; flex-wrap: wrap; }

/* ── Admin sections ────────────────────────────────────────────────────── */
.admin-section {
    padding: 3rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
}
.admin-section:last-child { border-bottom: none; }
.admin-section-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    direction: rtl;
}
.admin-section-head h2 {
    font-family: var(--font-ur);
    font-size: 1.8rem;
    color: var(--gold);
}
.admin-section-head .sub {
    color: var(--muted);
    font-size: 0.9rem;
    font-family: var(--font-en);
    font-style: italic;
    direction: ltr;
}

/* ── Public Content Manager ────────────────────────────────────────────── */
.pub-manager { background: rgba(201,168,76,0.03); }

/* Visibility toggle row */
.vis-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    direction: rtl;
}
.vis-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-ur);
    font-size: 0.95rem;
    color: var(--muted);
    transition: all .2s;
    user-select: none;
}
.vis-toggle.on { border-color: var(--gold); color: var(--gold); }
.vis-toggle input[type="checkbox"] { display: none; }
.vis-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background .2s;
    flex-shrink: 0;
}
.vis-toggle.on .vis-dot { background: var(--gold); }

/* Bio editor */
.pub-sub-head {
    font-family: var(--font-ur);
    font-size: 1.1rem;
    color: var(--text);
    direction: rtl;
    margin-bottom: 0.75rem;
    margin-top: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 1.5rem;
    color: var(--muted);
    font-family: var(--font-ur);
    font-size: 1rem;
    direction: rtl;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--gold);
    background: rgba(201,168,76,0.04);
    color: var(--gold);
}
.upload-zone .upload-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.upload-zone small { font-family: var(--font-ui); font-size: 0.75rem; display: block; margin-top: 0.4rem; color: var(--muted); direction: ltr; }

/* Admin photo grid */
.photo-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.photo-admin-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    overflow: hidden;
    transition: border-color .2s;
}
.photo-admin-card.is-public { border-color: var(--gold); }
.photo-admin-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}
.photo-admin-body {
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.photo-admin-body input[type="text"] {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    font-family: var(--font-ur);
    direction: rtl;
    outline: none;
    width: 100%;
    transition: border-color .2s;
}
.photo-admin-body input[type="text"]:focus { border-color: var(--gold); }
.photo-admin-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.pub-toggle-btn {
    flex: 1;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    transition: all .2s;
}
.pub-toggle-btn.is-public {
    background: rgba(201,168,76,0.15);
    border-color: var(--gold);
    color: var(--gold);
}
.del-photo-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all .2s;
}
.del-photo-btn:hover { border-color: var(--danger); color: var(--danger); }
.photo-count-badge {
    position: absolute;
    top: 0.4rem; left: 0.4rem;
    background: rgba(0,0,0,0.65);
    color: var(--gold);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    font-family: var(--font-ui);
    border-radius: 2px;
}

/* Pub actions row */
.pub-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    direction: ltr;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.pub-save-status {
    align-self: center;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--muted);
    margin-right: auto;
}
.pub-save-status.ok  { color: var(--success); }
.pub-save-status.busy { color: var(--gold); }

/* ── Comments moderation (admin) ───────────────────────────────────────── */
.pending-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    background: var(--gold);
    color: var(--bg);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}
.comments-admin-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.comment-row {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1rem 1.1rem;
}
.comment-row-head {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    flex-wrap: wrap;
    direction: rtl;
    margin-bottom: 0.5rem;
}
.comment-row-book { font-family: var(--font-ur); color: var(--gold); font-size: 0.9rem; }
.comment-row-author { font-family: var(--font-ur); color: var(--white); font-size: 0.9rem; }
.comment-row-date { font-family: var(--font-ui); color: var(--muted); font-size: 0.75rem; direction: ltr; margin-right: auto; }
.comment-row-body {
    font-family: var(--font-ur);
    color: var(--text);
    direction: rtl;
    text-align: right;
    line-height: 1.9;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}
.comment-row-actions { display: flex; gap: 0.5rem; direction: ltr; }
.comments-empty-admin {
    font-family: var(--font-ur);
    color: var(--muted);
    direction: rtl;
    text-align: center;
    padding: 1rem 0;
}

/* ── Media library (admin) ─────────────────────────────────────────────── */
.media-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.media-admin-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    overflow: hidden;
}
.media-admin-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.media-admin-body { padding: 0.65rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
    font-family: var(--font-ur);
    font-size: 0.95rem;
    color: var(--muted);
    direction: rtl;
    text-align: right;
}
.form-group input,
.form-group select,
.form-group textarea {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.65rem 1rem;
    font-size: 1rem;
    font-family: var(--font-en);
    outline: none;
    transition: border-color .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--gold); }
.form-group textarea { resize: vertical; min-height: 75px; }
.form-group select option { background: var(--surface-2); }

/* ── Book tabs ─────────────────────────────────────────────────────────── */
.book-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    direction: rtl;
}
.tab-btn {
    padding: 0.6rem 1.4rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-ur);
    font-size: 1rem;
    cursor: pointer;
    transition: all .2s;
    line-height: 2;
}
.tab-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.book-panel { display: none; }
.book-panel.active { display: block; }

/* ── Condition table ───────────────────────────────────────────────────── */
.condition-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    direction: rtl;
}
.condition-table th {
    background: var(--surface-2);
    padding: 0.55rem 0.75rem;
    font-family: var(--font-ui);
    color: var(--muted);
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.78rem;
    text-align: center;
}
.condition-table th:first-child { text-align: right; }
.condition-table td {
    border: 1px solid var(--border);
    padding: 0.55rem 0.75rem;
    font-family: var(--font-ur);
    line-height: 2;
}
.condition-table td.rc { text-align: center; }
.condition-table td.rc input[type="radio"] { accent-color: var(--gold); transform: scale(1.2); cursor: pointer; }
.condition-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Materials grid ────────────────────────────────────────────────────── */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}
.material-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color .2s;
}
.material-item:focus-within { border-color: var(--gold); }
.material-label {
    font-family: var(--font-ur);
    font-size: 1rem;
    color: var(--white);
    direction: rtl;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    line-height: 2;
}
.material-label input[type="checkbox"] { accent-color: var(--gold); transform: scale(1.2); flex-shrink: 0; }
.material-item textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    font-family: var(--font-en);
    resize: none;
    height: 48px;
    outline: none;
    transition: border-color .2s;
    direction: auto;
}
.material-item textarea:focus { border-color: var(--gold); color: var(--text); }

/* ── Phase checklist ───────────────────────────────────────────────────── */
.checklist { list-style: none; }
.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    direction: rtl;
    font-family: var(--font-ur);
    font-size: 1rem;
    line-height: 2;
    cursor: pointer;
}
.checklist li:last-child { border-bottom: none; }
.checklist li input[type="checkbox"] { accent-color: var(--gold); transform: scale(1.3); flex-shrink: 0; margin-top: 0.5rem; cursor: pointer; }

/* ── Save bar ──────────────────────────────────────────────────────────── */
.save-bar {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    z-index: 99;
}
.save-status { font-family: var(--font-ui); font-size: 0.875rem; color: var(--muted); }
.save-status.ok   { color: var(--success); }
.save-status.busy { color: var(--gold); }
.save-status.err  { color: var(--danger); }
.save-btns { display: flex; gap: 0.75rem; direction: ltr; flex-shrink: 0; }

/* ── Info box ──────────────────────────────────────────────────────────── */
.info-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-right: 3px solid var(--gold);
    padding: 1rem 1.25rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--muted);
    direction: ltr;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    header { padding: 3rem 1rem; }
    .container { padding: 0 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .admin-nav { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .save-bar { flex-direction: column; align-items: flex-start; }
    .books-grid { grid-template-columns: 1fr; }
    .materials-grid { grid-template-columns: 1fr; }
    .photo-admin-grid { grid-template-columns: repeat(2, 1fr); }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .lb-nav { font-size: 1.2rem; padding: 0.5rem 0.75rem; }
    .pub-actions { flex-direction: column; }
}
