/* KAVIR V36.5.88 — account workspace foundation
   Fixes student-library default view, fully off-canvas responsive drawers and CRM light surfaces.
   UI-only: no API, payment, authentication, CRM data or database contracts are changed. */

/* One predictable right-side drawer on desktop, tablet and mobile. */
#studentScreen .workspace-layout{
  grid-template-columns:minmax(0,1fr)!important;
}
#studentScreen .workspace-side,
#adminScreen .admin-side{
  position:fixed!important;
  inset:0 0 0 auto!important;
  top:0!important;right:0!important;left:auto!important;
  width:min(350px,calc(100vw - 28px))!important;
  max-width:calc(100vw - 20px)!important;
  height:100vh!important;height:100dvh!important;
  max-height:100dvh!important;
  margin:0!important;
  padding:16px 13px max(18px,env(safe-area-inset-bottom))!important;
  display:flex!important;flex-direction:column!important;align-items:stretch!important;
  gap:5px!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  border:0!important;border-left:1px solid var(--line,#eadfd7)!important;
  border-right:0!important;
  border-radius:20px 0 0 20px!important;
  background:var(--surface-solid,#fff)!important;
  color:var(--ink,#302a27)!important;
  box-shadow:-22px 0 60px rgba(32,23,48,.18)!important;
  z-index:1402!important;
  transform:translate3d(calc(100% + 48px),0,0)!important;
  visibility:hidden!important;opacity:0!important;pointer-events:none!important;
  transition:transform .28s cubic-bezier(.2,.8,.2,1),visibility .28s,opacity .22s!important;
  will-change:transform;
}
#studentScreen.kv-v12-student-nav-open .workspace-side,
#adminScreen.kv-v12-admin-nav-open .admin-side{
  transform:translate3d(0,0,0)!important;
  visibility:visible!important;opacity:1!important;pointer-events:auto!important;
}
#studentScreen .workspace-side .kv-v12-side-head,
#adminScreen .admin-side .kv-v12-side-head{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  flex:0 0 auto;min-height:54px;padding:3px 5px 13px!important;
  margin:0 0 10px!important;border-bottom:1px solid var(--line,#eadfd7)!important;
}
#studentScreen .workspace-side .kv-v12-side-close,
#adminScreen .admin-side .kv-v12-side-close{
  display:inline-flex!important;align-items:center;justify-content:center;
  flex:0 0 40px;width:40px;height:40px;
  border:1px solid var(--line,#eadfd7)!important;border-radius:12px!important;
  background:var(--bg2,#f8f3ef)!important;color:var(--ink,#302a27)!important;
}
#studentScreen .workspace-side .side-link,
#adminScreen .admin-side .admin-nav button{
  flex:0 0 auto;min-height:46px!important;white-space:normal!important;
  overflow-wrap:anywhere;line-height:1.75;
}
#studentScreen .kv-v12-side-shade,
#adminScreen .kv-v12-side-shade{
  position:fixed!important;inset:0!important;
  display:block!important;z-index:1401!important;
  border:0!important;border-radius:0!important;
  background:rgba(22,16,34,.48)!important;
  backdrop-filter:blur(3px);
  opacity:0!important;visibility:hidden!important;pointer-events:none!important;
  transition:opacity .22s ease,visibility .22s ease!important;
}
#studentScreen.kv-v12-student-nav-open .kv-v12-side-shade,
#adminScreen.kv-v12-admin-nav-open .kv-v12-side-shade{
  opacity:1!important;visibility:visible!important;pointer-events:auto!important;
}
body.kv-v12-drawer-open{overflow:hidden!important}
@media(max-width:520px){
  #studentScreen .workspace-side,#adminScreen .admin-side{
    width:min(340px,calc(100vw - 22px))!important;
    max-width:calc(100vw - 16px)!important;
    border-radius:16px 0 0 16px!important;
  }
}
@media(prefers-reduced-motion:reduce){
  #studentScreen .workspace-side,#adminScreen .admin-side,
  #studentScreen .kv-v12-side-shade,#adminScreen .kv-v12-side-shade{transition:none!important}
}

/* Student purchased library — light surfaces and readable full covers. */
html[data-theme="light"] #studentScreen .kv65-purchased-panel{
  background:#fff!important;color:#302a27!important;border-color:#ecdfd6!important;
  box-shadow:0 10px 32px rgba(83,57,38,.06)!important;
}
html[data-theme="light"] #studentScreen .kv65-purchase-card{
  background:#fff!important;color:#302a27!important;border-color:#ecdfd6!important;
}
html[data-theme="light"] #studentScreen .kv65-purchase-media{
  background:#f6f2fb!important;
}

/* CRM V16 and legacy V18: explicitly undo old dark-only surfaces in light mode. */
html[data-theme="light"] #admin-crm{
  color:#302a27!important;
  --crm-light-surface:#fff;
  --crm-light-soft:#fff8f2;
  --crm-light-border:#eddfd6;
  --crm-light-ink:#302a27;
  --crm-light-muted:#766b63;
}
html[data-theme="light"] #admin-crm :is(
  .kv18-crm-hub,.kv18-book,.kv18-manual-create,.kv18-assignment-list,
  .kv16-crm-board-card,.kv16-crm-followups,.kv16-crm-create,
  .kv16-crm-intelligence,.kv16-crm-sms-settings,
  .kv16-crm-intelligence-grid>section,.kv16-crm-metric,
  .kv16-followup-item,.kv16-lead-card,.kv16-crm-column,
  .kv16-board-column,.kv16-crm-column-body,.kv16-crm-board,
  .sms-surface,.sms-card,.sms-consent-explainer,.sms-books-grid>article,
  .admin-card,.panel-card,.table-wrap,.kv18-tab-pane .table-wrap
){
  background:#fff!important;background-image:none!important;
  color:#302a27!important;border-color:#eddfd6!important;
  box-shadow:0 8px 26px rgba(95,59,36,.055)!important;
}
html[data-theme="light"] #admin-crm .kv16-crm-intro{
  background:linear-gradient(115deg,#fff5ec,#fff 68%)!important;
  color:#302a27!important;border:1px solid #eddfd6!important;
  box-shadow:0 8px 26px rgba(95,59,36,.05)!important;
}
html[data-theme="light"] #admin-crm .kv18-crm-tabs{
  background:#fff7f1!important;border:1px solid #eddfd6!important;
}
html[data-theme="light"] #admin-crm .kv18-crm-tabs button{
  color:#665b54!important;background:transparent!important;
}
html[data-theme="light"] #admin-crm .kv18-crm-tabs button.active{
  color:#a94720!important;background:#ffe8d9!important;
  border-color:#efc9b4!important;box-shadow:none!important;
}
html[data-theme="light"] #admin-crm .kv18-book button{
  background:#fff4eb!important;color:#5a4033!important;border-color:#efd9ca!important;
}
html[data-theme="light"] #admin-crm :is(
  h1,h2,h3,h4,h5,h6,b,strong,label,summary,
  .kv16-card-top,.kv16-crm-toolbar,.kv16-period-filter,
  .kv18-crm-head,.kv18-pagination,.kv18-book b
){
  color:#302a27!important;
}
html[data-theme="light"] #admin-crm :is(
  p,small,.hint,.kv16-empty,.kv16-board-hint,
  .kv16-crm-intro p,.kv16-crm-board-card p,
  .kv16-crm-followups p,.kv18-crm-head p,
  .kv18-tab-pane p,.kv18-tab-pane td small,
  .kv18-book small,.kv16-crm-metric span
){
  color:#766b63!important;
}
html[data-theme="light"] #admin-crm :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]){
  color:#302a27!important;background:#fff!important;
  border-color:#e8d8ce!important;color-scheme:light!important;
}
html[data-theme="light"] #admin-crm :is(input,textarea)::placeholder{
  color:#968980!important;opacity:1!important;
}
html[data-theme="light"] #admin-crm .kv18-tab-pane select option{
  color:#302a27!important;background:#fff!important;
}
html[data-theme="light"] #admin-crm .kv18-tab-pane table,
html[data-theme="light"] #admin-crm table{
  background:#fff!important;color:#302a27!important;
}
html[data-theme="light"] #admin-crm :is(th,.kv18-tab-pane th){
  background:#fff2e8!important;color:#45352d!important;border-color:#eddfd6!important;
}
html[data-theme="light"] #admin-crm :is(td,.kv18-tab-pane td){
  background:#fff!important;color:#443a34!important;border-color:#efe4dc!important;
}
html[data-theme="light"] #admin-crm .kv18-pill{
  background:#fff0e4!important;color:#a94e27!important;
}
html[data-theme="light"] #admin-crm .kv16-crm-metric b{
  color:#b85b2e!important;
}
html[data-theme="light"] #admin-crm .kv16-lead-card :is(h3,b,strong){
  color:#302a27!important;
}
html[data-theme="light"] #v16CrmDrawer.kv16-crm-drawer{
  background:#fff!important;color:#302a27!important;border-color:#eddfd6!important;
  box-shadow:-18px 0 55px rgba(56,38,25,.15)!important;
}
html[data-theme="light"] #v16CrmDrawer :is(h2,h3,h4,b,strong,label,span,p,small){
  color:#302a27;
}
html[data-theme="light"] #v16CrmDrawer :is(p,small,.hint){
  color:#766b63!important;
}
html[data-theme="light"] #v16CrmDrawer :is(input,select,textarea){
  background:#fff!important;color:#302a27!important;border-color:#e8d8ce!important;
  color-scheme:light!important;
}

/* Keep the image-fit rule last in the homepage cascade. */
#studentScreen .kv65-purchase-media img{
  object-fit:contain!important;object-position:center center!important;
}
