/* /khalwati-public-assets/site-shell-r5.css */
/* =========================================================
   KHALWATI SITE SHELL R5 — 2026-09-27
   Unified identity, no-flash library, Safari-safe controls.
   One public header/footer across the whole website.
   ========================================================= */
:root{--kh-shell-bg:#fbf6e9;--kh-shell-card:#fffdf8;--kh-shell-deep:#073f34;--kh-shell-green:#0a684e;--kh-shell-line:rgba(190,151,67,.28)}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-height:100vh;display:flex;flex-direction:column}
body>main{flex:1 0 auto;min-width:0}
.site-header{position:sticky!important;top:0!important;z-index:70!important;padding:max(7px,env(safe-area-inset-top)) 0 0!important;background:linear-gradient(180deg,rgba(251,246,233,.985),rgba(251,246,233,.925))!important;border:0!important;-webkit-backdrop-filter:blur(16px)!important;backdrop-filter:blur(16px)!important}
.site-header .header-inner,.home-refined .site-header .header-inner{width:min(1240px,calc(100% - 28px))!important;height:64px!important;min-height:64px!important;margin:0 auto 7px!important;padding:0 13px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:14px!important;border:1px solid var(--kh-shell-line)!important;border-radius:18px!important;background:rgba(255,253,248,.965)!important;box-shadow:0 8px 24px rgba(56,41,10,.055)!important}
.site-header .kh-brand,.site-header .brand{display:inline-flex!important;align-items:center!important;gap:9px!important;min-width:0!important;flex:0 1 auto!important;color:var(--kh-shell-deep)!important;text-decoration:none!important}
.site-header .kh-brand-mark{width:40px;height:40px;flex:0 0 40px;display:grid;place-items:center}
.site-header .kh-brand img,.site-header .brand img,.home-refined .site-header .brand img{width:40px!important;height:40px!important;display:block!important;object-fit:contain!important;flex:0 0 40px!important}
.site-header .kh-brand-copy{display:flex;align-items:center;min-width:0}
.site-header .kh-brand-copy strong,.site-header .brand strong{margin:0!important;color:var(--kh-shell-deep)!important;font-size:.96rem!important;line-height:1.35!important;font-weight:800!important;white-space:nowrap!important}
.site-header .kh-brand-copy small{display:none!important}
.site-header .nav-links,.home-refined .site-header .nav-links{display:flex!important;flex:1 1 auto!important;align-items:center!important;justify-content:center!important;gap:1px!important;min-width:0!important}
.site-header .nav-links a,.home-refined .site-header .nav-links a{min-height:40px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;padding:0 9px!important;border-radius:11px!important;color:#315247!important;font-size:.84rem!important;font-weight:750!important;line-height:1.25!important;white-space:nowrap!important;text-decoration:none!important;transition:background-color .16s ease,color .16s ease!important}
.site-header .nav-links a:hover,.site-header .nav-links a:focus-visible{background:#f2ecdc!important;color:var(--kh-shell-deep)!important}
.site-header .nav-links a[aria-current="page"]{background:#e8f1e9!important;color:var(--kh-shell-green)!important}
.site-header .header-actions,.home-refined .site-header .header-actions{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:7px!important;flex:0 0 auto!important}
.site-header .icon-btn{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important;padding:0!important;border:1px solid #ded1b2!important;border-radius:12px!important;background:#fffdf8!important;color:var(--kh-shell-deep)!important;box-shadow:none!important}
.site-header .mobile-menu{display:none!important}
.site-header .mobile-menu svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}

/* Shared footer */
.site-footer{flex:0 0 auto!important;margin-top:28px!important;padding:18px 0 max(18px,env(safe-area-inset-bottom))!important;border-top:1px solid rgba(201,154,55,.22)!important;background:rgba(255,253,248,.72)!important;color:#66766f!important}
.site-footer .footer-inner{width:min(1240px,calc(100% - 28px))!important;min-height:48px!important;margin:0 auto!important;display:grid!important;grid-template-columns:minmax(0,1fr) auto auto!important;align-items:center!important;gap:20px!important}
.footer-brand{display:inline-flex;align-items:center;gap:9px;min-width:0;color:var(--kh-shell-deep)!important;font-weight:800;text-decoration:none!important}
.footer-brand img{width:34px;height:34px;object-fit:contain;flex:0 0 34px}
.footer-brand span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.site-footer .footer-links{display:flex!important;align-items:center!important;justify-content:center!important;gap:4px!important;flex-wrap:wrap!important;margin:0!important}
.site-footer .footer-links a{padding:7px 9px;border-radius:9px;color:#48675d!important;font-weight:700;text-decoration:none!important}
.site-footer .footer-links a:hover,.site-footer .footer-links a:focus-visible{background:#f2ecdc;color:var(--kh-shell-deep)!important}
.footer-copy{white-space:nowrap;color:#877c68;font-size:.82rem}

/* Privacy page keeps its readable content width while shell stays full-width. */
.privacy-content{width:min(900px,calc(100% - 32px))!important;margin:0 auto!important}

@media(max-width:1100px){
  .site-header .nav-links,.home-refined .site-header .nav-links{display:none!important}
  .site-header .mobile-menu,.home-refined .site-header .mobile-menu{display:inline-flex!important}
}
@media(max-width:700px){
  .site-header{padding-top:max(5px,env(safe-area-inset-top))!important}
  .site-header .header-inner,.home-refined .site-header .header-inner{width:calc(100% - 18px)!important;height:58px!important;min-height:58px!important;margin-bottom:6px!important;padding:0 10px!important;border-radius:15px!important;gap:8px!important}
  .site-header .kh-brand-mark{width:34px;height:34px;flex-basis:34px}
  .site-header .kh-brand img,.site-header .brand img,.home-refined .site-header .brand img{width:34px!important;height:34px!important;flex-basis:34px!important}
  .site-header .kh-brand-copy strong,.site-header .brand strong{max-width:min(66vw,270px)!important;font-size:.88rem!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .site-header .icon-btn{width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
  .site-footer{margin-top:22px!important;padding-top:16px!important}
  .site-footer .footer-inner{width:calc(100% - 24px)!important;grid-template-columns:1fr!important;justify-items:center!important;gap:8px!important;text-align:center!important}
  .footer-brand{max-width:100%;justify-content:center}
  .site-footer .footer-links{gap:1px!important}
  .site-footer .footer-links a{padding:7px 6px;font-size:.82rem}
}
@media(max-width:390px){
  .site-header .kh-brand-copy strong,.site-header .brand strong{max-width:220px!important;font-size:.83rem!important}
  .footer-brand span{font-size:.87rem}
}
@media(prefers-reduced-motion:reduce){.site-header .nav-links a{transition:none!important}}

/* Library preference card is present in HTML before async sync, so there is no layout flash. */
.kh-lib-pref{width:100%;min-height:74px;box-sizing:border-box;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:13px;margin:14px 0 18px;padding:12px 15px;border:1px solid rgba(194,153,67,.34);border-radius:18px;background:linear-gradient(180deg,#fffdf9 0%,#fcf8ee 100%);box-shadow:0 7px 20px rgba(44,65,53,.045);color:#173f34;cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:rgba(7,88,61,.08)}
.kh-lib-pref-input{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;clip-path:inset(50%)!important;white-space:nowrap!important}
.kh-lib-pref-icon{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;border-radius:13px;background:#f5ecd5;color:#9a7019;flex:0 0 44px}.kh-lib-pref-icon svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.kh-lib-pref-copy{min-width:0;display:block;text-align:right;direction:rtl}.kh-lib-pref-copy strong{display:block;margin:0 0 2px;color:#123d31;font-size:.98rem;line-height:1.45;font-weight:800}.kh-lib-pref-copy small{display:block;color:#817965;font-size:.79rem;line-height:1.55}
.kh-lib-switch{position:relative;width:48px;height:28px;display:inline-block;flex:0 0 48px;border-radius:999px;background:#d8d2c4;box-shadow:inset 0 0 0 1px rgba(39,63,52,.08);transition:background-color .16s ease}.kh-lib-switch::after{content:"";position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 2px 7px rgba(31,52,42,.22);transition:transform .16s ease}.kh-lib-pref-input:checked~.kh-lib-switch{background:#0b6a4c}.kh-lib-pref-input:checked~.kh-lib-switch::after{transform:translateX(20px)}.kh-lib-pref-input:focus-visible~.kh-lib-switch{outline:3px solid rgba(18,112,78,.20);outline-offset:3px}
@media(max-width:600px){.kh-lib-pref{min-height:68px;grid-template-columns:40px minmax(0,1fr) 46px;gap:10px;margin:10px 0 14px;padding:11px 12px;border-radius:16px}.kh-lib-pref-icon{width:40px;height:40px;flex-basis:40px;border-radius:12px}.kh-lib-pref-copy strong{font-size:.92rem}.kh-lib-pref-copy small{font-size:.74rem}.kh-lib-switch{width:46px;height:27px;flex-basis:46px}.kh-lib-switch::after{width:19px;height:19px}.kh-lib-pref-input:checked~.kh-lib-switch::after{transform:translateX(19px)}}
@media(prefers-reduced-motion:reduce){.kh-lib-switch,.kh-lib-switch::after{transition:none}}

/* Static styles used by library-auto-sync: no style injection after first paint. */
.kh-cover-placeholder{width:100%;height:100%;min-height:220px;display:grid;place-items:center;text-align:center;padding:16px;background:#f5edd9;color:#074a3e;font-weight:800;border-radius:inherit}
.books-grid[data-khalwati-live="1"] .book-card{cursor:pointer}
.library-tools.kh-filters-only{justify-content:center}

/* R6 Audio navigation */
.site-header .kh-audio-link>span,.drawer .kh-audio-link>span{display:inline-block;margin-inline-end:4px;font-size:.92em;line-height:1;color:#a87717}


/* R6c: dynamic library first-paint guard. */
.books-grid:not([data-khalwati-live]){position:relative;min-height:240px}
.books-grid:not([data-khalwati-live])>.book-card{opacity:0;visibility:hidden;pointer-events:none}
.books-grid:not([data-khalwati-live])::before{content:"جاري تحديث المكتبة…";position:absolute;inset:18px 0 auto;min-height:118px;display:grid;place-items:center;border:1px solid #ead8aa;border-radius:18px;background:linear-gradient(100deg,#fffdf8 30%,#f7efd9 50%,#fffdf8 70%);background-size:220% 100%;color:#0a5b48;font-weight:800;animation:khLibraryLoading 1.25s linear infinite;z-index:2}
.books-grid[data-khalwati-live]::before{display:none}
.book-cover-wrap{position:relative;overflow:hidden;background:#f4efe4}
.book-cover-wrap.kh-cover-loading::after{content:"";position:absolute;inset:0;background:linear-gradient(105deg,#f2ead8 25%,#fffaf0 45%,#f2ead8 65%);background-size:220% 100%;animation:khLibraryLoading 1.15s linear infinite}
.book-cover-wrap img.kh-cover-img-loading{opacity:0}
.book-cover-wrap img{transition:opacity .16s ease}
@keyframes khLibraryLoading{to{background-position:-220% 0}}
@media (prefers-reduced-motion:reduce){.books-grid:not([data-khalwati-live])::before,.book-cover-wrap.kh-cover-loading::after{animation:none}}
@media(max-width:640px){.books-grid:not([data-khalwati-live]){min-height:190px}.books-grid:not([data-khalwati-live])::before{min-height:96px;font-size:.92rem}}

/* R7 book metadata cards */
.book-card .kh-card-subtitle{margin:2px 0 4px;color:#786f60;font-size:.84rem;line-height:1.55;text-align:center;min-height:0}
.book-card .kh-card-author{margin:1px 0 5px;color:#31584d;font-size:.8rem;line-height:1.5;font-weight:700;text-align:center}
.book-card .kh-card-subtitle[hidden],.book-card .kh-card-author[hidden]{display:none!important}
@media(max-width:600px){.book-card .kh-card-subtitle{font-size:.76rem}.book-card .kh-card-author{font-size:.74rem}}

/* Khalwati Responsive V38.1 — desktop/tablet/mobile/touch */
html{max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%}
body{max-width:100%;overflow-x:hidden;overscroll-behavior-x:none}
*,*::before,*::after{box-sizing:border-box}
img,video,iframe,canvas,svg{max-width:100%}
:where(a,button,input,select,textarea,[role="button"]){touch-action:manipulation}
:where(button,.button,.icon-btn,.filter,.book-card,a){-webkit-tap-highlight-color:rgba(7,81,63,.10)}
:where(button,.button,.icon-btn,.filter){min-height:44px}
:where(input,select,textarea){max-width:100%}

/* Avoid rendering large off-screen collections until they approach the viewport. */
.books-grid>.book-card,.library-grid>.book-card,.section-grid>*{content-visibility:auto;contain-intrinsic-size:320px}

/* Mobile drawer: stable fixed layer, touch safe, no page scroll behind it. */
.drawer{position:fixed!important;inset:0!important;z-index:1000!important;pointer-events:none!important;visibility:hidden!important}
.drawer.open{pointer-events:auto!important;visibility:visible!important}
.drawer .drawer-backdrop{position:absolute!important;inset:0!important;background:rgba(11,33,27,.42)!important;opacity:0!important;transition:opacity .18s ease!important}
.drawer.open .drawer-backdrop{opacity:1!important}
.drawer .drawer-panel{position:absolute!important;top:0!important;bottom:0!important;inset-inline-end:0!important;width:min(88vw,360px)!important;max-width:100%!important;overflow-y:auto!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;transform:translateX(105%)!important;transition:transform .2s ease!important;padding-bottom:max(20px,env(safe-area-inset-bottom))!important}
[dir="rtl"] .drawer .drawer-panel{transform:translateX(-105%)!important}
.drawer.open .drawer-panel{transform:translateX(0)!important}
body.kh-drawer-open{overflow:hidden!important;touch-action:none!important}
.drawer .drawer-panel nav a{min-height:48px!important;display:flex!important;align-items:center!important}

/* Keep long content and forms within viewport. */
.container,.library-shell,.page-hero,main,section,article{min-width:0;max-width:100%}
pre,code{max-width:100%;overflow-wrap:anywhere}

@media(max-width:900px){
  .container{width:min(100% - 24px,1240px)!important}
  .site-header .header-inner{width:calc(100% - 20px)!important}
  .books-grid{gap:14px!important}
}
@media(max-width:600px){
  :where(input:not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:16px!important}
  .container{width:calc(100% - 20px)!important}
  .page-hero{padding-inline:4px!important}
  .books-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .book-card{min-width:0!important;padding:10px!important}
  .book-card h3{overflow-wrap:anywhere!important}
  .library-tools,.filters{max-width:100%!important;overflow-x:auto!important;overscroll-behavior-inline:contain!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:thin}
  .filters{flex-wrap:nowrap!important;justify-content:flex-start!important;padding-bottom:4px!important}
  .filter{flex:0 0 auto!important;white-space:nowrap!important}
}
@media(max-width:360px){
  .books-grid{grid-template-columns:1fr!important}
  .site-header .kh-brand-copy strong,.site-header .brand strong{max-width:180px!important}
}
@media(hover:none) and (pointer:coarse){
  :where(a,button,.button,.icon-btn,.filter){min-height:44px}
}
@media(prefers-reduced-motion:reduce){
  .drawer .drawer-backdrop,.drawer .drawer-panel{transition:none!important}
}

/* V38.1 — centered book-card copy + large category/sheikh collections */
.book-card{text-align:center!important;align-items:center!important}
.book-card h3,.book-card .cat,.book-card .open,.book-card .kh-card-subtitle,.book-card .kh-card-author{width:100%;text-align:center!important;margin-inline:auto!important}
.book-card h3{display:flex;align-items:center;justify-content:center;min-height:2.9em;line-height:1.45}
.book-card .cat{display:flex;align-items:center;justify-content:center;min-height:1.6em}
.book-card .open{display:flex;align-items:center;justify-content:center;margin-top:auto!important;min-height:44px}
.kh-category-status{margin:10px auto 18px;padding:10px 16px;width:max-content;max-width:100%;border:1px solid #ead8aa;border-radius:999px;background:#fffaf0;color:#07513f;font-weight:800;text-align:center}
.kh-category-status[hidden]{display:none!important}
.books-grid .book-card[hidden]{display:none!important}
@media(max-width:600px){.book-card h3{min-height:3.1em}.kh-category-status{width:100%;border-radius:14px}}

/* Khalwati Responsive V50 — category-only library books + optional Home visibility */


/* Khalwati Library V50 — scalable sheikh/category browsing */
.kh-library-search{display:block;width:min(680px,100%);margin:0 auto 14px}.kh-library-search input{width:100%;min-height:48px;border:1px solid #d9c58f;border-radius:16px;background:#fffefb;padding:10px 16px;font:inherit;font-size:16px;color:inherit;outline:none}.kh-library-search input:focus{border-color:#a77a22;box-shadow:0 0 0 3px rgba(167,122,34,.12)}.library-tools.kh-filters-only{overflow-x:auto;overscroll-behavior-inline:contain;padding-bottom:6px}.library-tools .filters{display:flex;flex-wrap:nowrap;min-width:max-content}.library-tools .filter{white-space:nowrap;min-height:44px}.books-grid{align-items:stretch}.book-card{height:100%}.book-card .book-cover-wrap{margin-inline:auto}@media(max-width:600px){.kh-library-search{margin-bottom:10px}.library-tools.kh-filters-only{margin-inline:-4px;padding-inline:4px}}


/* Khalwati Library V50 — no horizontal category bars, responsive category cards */
.library-page-ui3{overflow-x:hidden}
.library-shell,.library-shell .container{min-width:0;max-width:100%}
.library-tools.kh-filters-only{width:100%!important;max-width:100%!important;overflow:visible!important;overscroll-behavior:auto!important;padding:0!important;margin:0 auto 18px!important}
.library-tools.kh-filters-only .filters{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(170px,1fr))!important;gap:10px!important;width:100%!important;min-width:0!important;max-width:100%!important;overflow:visible!important;padding:0!important;justify-content:stretch!important}
.library-tools.kh-filters-only .filter{min-width:0!important;width:100%!important;min-height:64px!important;white-space:normal!important;border-radius:16px!important;padding:10px 12px!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:3px!important;text-align:center!important;line-height:1.35!important}
.library-tools.kh-filters-only .filter .kh-filter-label{display:block;width:100%;font-weight:800;overflow-wrap:anywhere}
.library-tools.kh-filters-only .filter .kh-filter-count{display:block;font-size:.78rem;font-weight:600;opacity:.72}
.library-tools.kh-filters-only .filter.active{box-shadow:0 0 0 2px rgba(167,122,34,.10) inset}
.kh-library-search{width:min(760px,100%)!important;margin:0 auto 16px!important}
.kh-library-search input{min-height:52px!important;border-radius:18px!important;padding-inline:18px!important}
.kh-category-status{display:grid!important;grid-template-columns:1fr auto!important;grid-template-areas:'name back' 'count back';align-items:center!important;gap:2px 12px!important;width:min(760px,100%)!important;max-width:100%!important;margin:0 auto 20px!important;border-radius:18px!important;padding:12px 14px!important;text-align:right!important}
.kh-category-status-name{grid-area:name;font-size:1rem}
.kh-category-status-count{grid-area:count;color:#786f60;font-size:.82rem;font-weight:700}
.kh-category-status-back{grid-area:back;min-height:42px;border:1px solid #d9c58f;border-radius:12px;background:#fffefb;color:#07513f;padding:7px 12px;font:inherit;font-weight:800;cursor:pointer}
.kh-category-status[hidden]{display:none!important}
@media(max-width:760px){.library-tools.kh-filters-only .filters{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}.library-tools.kh-filters-only .filter{min-height:58px!important;padding:9px 8px!important;font-size:.92rem!important}.kh-library-search{margin-bottom:12px!important}}
@media(max-width:360px){.library-tools.kh-filters-only .filters{grid-template-columns:1fr!important}.kh-category-status{grid-template-columns:1fr!important;grid-template-areas:'name' 'count' 'back';text-align:center!important}.kh-category-status-back{width:100%;margin-top:6px}}

/* Khalwati Library V52 — focused Sheikh/category view + obvious back controls */
.library-shell.kh-category-focused .library-tools.kh-filters-only{display:none!important}
.library-shell.kh-category-focused .kh-lib-pref{display:none!important}
.kh-category-status{scroll-margin-top:88px}
.kh-category-status{grid-template-columns:auto minmax(0,1fr)!important;grid-template-areas:'back copy'!important}.kh-category-status-copy{grid-area:copy;min-width:0;display:flex;flex-direction:column;gap:2px;align-items:flex-start}.kh-category-status-copy .kh-category-status-name,.kh-category-status-copy .kh-category-status-count{grid-area:auto!important}
.kh-category-status-back.kh-category-back-primary{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:132px;background:#07513f;color:#fff;border-color:#07513f;box-shadow:0 6px 16px rgba(7,81,63,.14)}
.kh-category-status-back.kh-category-back-primary:hover{filter:brightness(1.04)}
.kh-category-bottom-back{display:flex;justify-content:center;margin:22px auto 4px;width:100%}
.kh-category-bottom-back[hidden]{display:none!important}
.kh-category-bottom-back-btn{min-height:46px;border:1px solid #d7bd7b;border-radius:14px;background:#fffaf0;color:#07513f;padding:9px 18px;font:inherit;font-weight:900;cursor:pointer}
.library-shell.kh-category-focused .books-grid{margin-top:4px}
@media(max-width:600px){
  .kh-category-status{grid-template-columns:1fr!important;grid-template-areas:none!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:10px!important;text-align:center!important}
  .kh-category-status-copy{align-items:center!important}
  .kh-category-status-back.kh-category-back-primary,.kh-category-bottom-back-btn{width:100%!important}
}


/* Khalwati V62 — compact responsive category cards: wider, lower, readable on every viewport */
.library-tools.kh-filters-only .filters{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr))!important;
  gap:9px!important;
  width:100%!important;min-width:0!important;overflow:visible!important;
}
.library-tools.kh-filters-only .filter{
  min-height:52px!important;height:auto!important;
  padding:8px 11px!important;border-radius:14px!important;
  display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;gap:9px!important;text-align:start!important;
  white-space:normal!important;
}
.library-tools.kh-filters-only .filter .kh-filter-label{
  min-width:0!important;font-size:.94rem!important;font-weight:800!important;
  line-height:1.35!important;text-align:start!important;overflow-wrap:anywhere!important;
}
.library-tools.kh-filters-only .filter .kh-filter-count{
  min-width:30px!important;height:30px!important;padding:0 8px!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  border-radius:999px!important;background:#f3ead8!important;color:#7c6429!important;
  font-size:.78rem!important;font-weight:900!important;opacity:1!important;white-space:nowrap!important;
}
.library-tools.kh-filters-only .filter.active .kh-filter-count{background:rgba(255,255,255,.16)!important;color:#fff!important}
.kh-category-status{min-height:54px!important;padding:8px 10px!important;border-radius:14px!important;margin-bottom:14px!important}
.kh-category-status-copy{flex-direction:row!important;align-items:center!important;gap:8px!important;min-width:0!important}
.kh-category-status-name{font-size:.98rem!important;line-height:1.35!important;overflow-wrap:anywhere!important}
.kh-category-status-count{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:30px!important;height:30px!important;padding:0 8px!important;border-radius:999px!important;background:#f3ead8!important;color:#7c6429!important;font-size:.78rem!important;white-space:nowrap!important}
.kh-category-status-back.kh-category-back-primary{min-width:118px!important;min-height:40px!important;padding:6px 10px!important}
@media(max-width:900px){.library-tools.kh-filters-only .filters{grid-template-columns:repeat(3,minmax(0,1fr))!important}.library-tools.kh-filters-only .filter{min-height:50px!important}}
@media(max-width:640px){.library-tools.kh-filters-only .filters{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}.library-tools.kh-filters-only .filter{min-height:50px!important;padding:7px 9px!important}.library-tools.kh-filters-only .filter .kh-filter-label{font-size:.88rem!important}.kh-category-status{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:7px!important}.kh-category-status-copy{justify-content:center!important}.kh-category-status-back.kh-category-back-primary{width:100%!important}}
@media(max-width:340px){.library-tools.kh-filters-only .filters{grid-template-columns:1fr!important}}


/* Khalwati V64 — cross-device public layout sweep */
html,body{max-width:100%;overflow-x:hidden}
:where(main,section,article,.container,.page-hero,.library-shell,.audio-shell,.content-shell){min-width:0;max-width:100%}
:where(img,video,canvas,iframe){max-width:100%;height:auto}
:where(input:not([type="checkbox"]):not([type="radio"]),select,textarea,button,.btn,.filter){box-sizing:border-box;max-width:100%}
.site-header .header-inner,.footer-inner{min-width:0}
.nav-links{min-width:0;flex-wrap:wrap}
@media(max-width:1024px){.container{width:min(100% - 24px,1180px)!important}.page-hero{padding-block:22px!important}}
@media(max-width:700px){.container{width:calc(100% - 18px)!important}.page-hero{padding-block:16px!important}.page-hero h1{font-size:clamp(1.55rem,7vw,2.1rem)!important}.site-footer .footer-inner{gap:14px}.footer-links{display:flex;flex-wrap:wrap;justify-content:center;gap:8px 14px}.books-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}.book-card{min-width:0!important}}
@media(max-width:380px){.container{width:calc(100% - 12px)!important}.books-grid{grid-template-columns:1fr!important}.page-hero{padding-inline:2px!important}}
@media(hover:none) and (pointer:coarse){:where(a,button,.btn,.filter,.icon-btn){min-height:44px}}

/* KHALWATI V11.46 — COMPACT SEARCH ONLY; BOOK COVER/GRID SIZE RESTORED TO ORIGINAL */
/* User requested a smaller library search, but book/card/cover/grid dimensions now fall back to the original production CSS. */
@media (min-width: 901px) {
  .kh-library-search { width:min(420px,100%)!important; max-width:420px!important; margin:0 auto 9px!important; }
  .kh-library-search input { width:100%!important; min-height:36px!important; height:36px!important; padding:5px 12px!important; border-radius:12px!important; font-size:.89rem!important; }
}
.books-grid .book-card .kh-card-edition, .library-grid .book-card .kh-card-edition, .book-grid .book-card .kh-card-edition { display:none!important; }
/* /KHALWATI V11.46 */
/* =========================================================
   KHALWATI V11.48 — PUBLIC FOOTER STABILITY / PROFESSIONAL SHELL
   Existing served asset patch; no new public static dependency.
   ========================================================= */
.site-footer{
  flex:0 0 auto!important;
  width:100%!important;
  margin-top:32px!important;
  padding:0!important;
  border-top:1px solid rgba(190,151,67,.24)!important;
  background:rgba(255,253,248,.94)!important;
  color:#64736c!important;
  overflow:hidden!important;
}
.site-footer .footer-inner{
  width:min(1180px,calc(100% - 32px))!important;
  max-width:1180px!important;
  min-height:70px!important;
  margin:0 auto!important;
  padding:13px 0!important;
  display:grid!important;
  grid-template-columns:minmax(210px,1fr) minmax(0,2.15fr) auto!important;
  grid-template-areas:"brand links copy"!important;
  align-items:center!important;
  justify-content:stretch!important;
  gap:16px!important;
  text-align:initial!important;
  box-sizing:border-box!important;
  min-width:0!important;
}
.site-footer .footer-brand{
  grid-area:brand!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-self:start!important;
  gap:9px!important;
  min-width:0!important;
  max-width:100%!important;
  margin:0!important;
  color:#073f34!important;
  font-weight:800!important;
  text-decoration:none!important;
}
.site-footer .footer-brand img{
  width:32px!important;
  height:32px!important;
  flex:0 0 32px!important;
  object-fit:contain!important;
}
.site-footer .footer-brand span{
  display:block!important;
  min-width:0!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  line-height:1.45!important;
  font-size:.9rem!important;
}
.site-footer .footer-links{
  grid-area:links!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  flex-wrap:wrap!important;
  gap:4px 6px!important;
}
.site-footer .footer-links a{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:34px!important;
  padding:6px 9px!important;
  border-radius:9px!important;
  white-space:nowrap!important;
  color:#48675d!important;
  font-size:.82rem!important;
  line-height:1.25!important;
  font-weight:750!important;
  text-decoration:none!important;
  box-sizing:border-box!important;
}
.site-footer .footer-links a:hover,
.site-footer .footer-links a:focus-visible{
  background:#f2ecdc!important;
  color:#073f34!important;
}
.site-footer .footer-copy{
  grid-area:copy!important;
  justify-self:end!important;
  white-space:nowrap!important;
  color:#877c68!important;
  font-size:.78rem!important;
  line-height:1.4!important;
}
@media(max-width:980px){
  .site-footer .footer-inner{
    width:calc(100% - 28px)!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:"brand copy" "links links"!important;
    gap:6px 14px!important;
    padding:12px 0 14px!important;
  }
  .site-footer .footer-links{padding-top:4px!important}
}
@media(max-width:640px){
  .site-footer{margin-top:22px!important}
  .site-footer .footer-inner{
    width:calc(100% - 20px)!important;
    grid-template-columns:1fr!important;
    grid-template-areas:"brand" "links" "copy"!important;
    justify-items:center!important;
    gap:8px!important;
    padding:13px 0 max(14px,env(safe-area-inset-bottom))!important;
    text-align:center!important;
  }
  .site-footer .footer-brand{justify-self:center!important;justify-content:center!important}
  .site-footer .footer-brand img{width:30px!important;height:30px!important;flex-basis:30px!important}
  .site-footer .footer-brand span{font-size:.86rem!important;text-align:center!important}
  .site-footer .footer-links{
    width:min(100%,430px)!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:4px 7px!important;
    padding:2px 0!important;
  }
  .site-footer .footer-links a{
    width:100%!important;
    min-width:0!important;
    min-height:36px!important;
    padding:6px 7px!important;
    white-space:normal!important;
    text-align:center!important;
    overflow-wrap:anywhere!important;
  }
  .site-footer .footer-copy{justify-self:center!important;font-size:.74rem!important}
}
@media(max-width:350px){
  .site-footer .footer-inner{width:calc(100% - 14px)!important}
  .site-footer .footer-links{grid-template-columns:1fr!important;width:min(100%,280px)!important}
}

/* /khalwati-public-assets/live-popup-r7.css */
.kh-live-pop{position:fixed;z-index:9998;inset:auto 22px 22px auto;width:min(410px,calc(100vw - 32px));direction:rtl;font-family:Tajawal,system-ui,sans-serif;background:#fffdf8;border:1px solid #e9cc83;border-radius:20px;box-shadow:0 22px 60px rgba(20,63,49,.22);overflow:hidden;color:#103f32}.kh-live-pop[hidden]{display:none}.kh-live-pop-media{height:118px;background:linear-gradient(135deg,#0a684e,#123d31);display:grid;place-items:center;overflow:hidden}.kh-live-pop-media img{width:100%;height:100%;object-fit:cover}.kh-live-pop-media span{font-size:34px;color:#f2bd42}.kh-live-pop-body{padding:16px}.kh-live-pop-row{display:flex;align-items:center;gap:8px;margin-bottom:8px}.kh-live-pop-dot{width:10px;height:10px;border-radius:999px;background:#c62828;box-shadow:0 0 0 5px rgba(198,40,40,.11)}.kh-live-pop-kicker{font-weight:800;color:#a74b3d;font-size:13px}.kh-live-pop h2{font-size:20px;line-height:1.4;margin:4px 0}.kh-live-pop p{margin:0;color:#6b6252;font-size:14px;line-height:1.7}.kh-live-pop-actions{display:flex;gap:10px;margin-top:14px}.kh-live-pop-actions a,.kh-live-pop-actions button{min-height:44px;border-radius:12px;padding:0 16px;font:inherit;font-weight:800;cursor:pointer}.kh-live-pop-actions a{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;background:#0a684e;color:#fff;border:1px solid #0a684e;flex:1}.kh-live-pop-actions button{background:#fff;border:1px solid #decba0;color:#123d31}.kh-live-link{white-space:nowrap}@media(max-width:680px){.kh-live-pop{inset:auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;width:auto}.kh-live-pop-media{height:96px}.kh-live-pop h2{font-size:18px}}
@media(prefers-reduced-motion:no-preference){.kh-live-pop:not([hidden]){animation:khLiveIn .22s ease-out}@keyframes khLiveIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}}

