/* AD ASTRA — My Exams master dark-surface palette
   Scope: Admin Control Centre and non-Exam Student Workspace only.
   The live Exam page never receives workspace-dark-theme. */
body.workspace-dark-theme:not(.exam-portal){
  --workspace-page:#01050a;
  --workspace-surface:#02070e;
  --workspace-surface-raised:#050b13;
  --workspace-surface-soft:#08101a;
  --workspace-border:rgba(201,150,26,.38);
  --workspace-border-soft:rgba(201,150,26,.22);
  background:#01050a!important;
  background-image:none!important;
}
body.workspace-dark-theme:not(.exam-portal)::before{
  background:linear-gradient(180deg,#01050a 0%,#02070e 55%,#01050a 100%)!important;
  opacity:1!important;
}
body.workspace-dark-theme:not(.exam-portal) .star-field{opacity:.18!important;}
body.workspace-dark-theme:not(.exam-portal) .app-shell,
body.workspace-dark-theme:not(.exam-portal) .admin-shell,
body.workspace-dark-theme:not(.exam-portal) .student-shell,
body.workspace-dark-theme:not(.exam-portal) .app-main,
body.workspace-dark-theme:not(.exam-portal) main.app-main,
body.workspace-dark-theme:not(.exam-portal) main,
body.workspace-dark-theme:not(.exam-portal) .page,
body.workspace-dark-theme:not(.exam-portal) .content,
body.workspace-dark-theme:not(.exam-portal) .main-content{
  background:transparent!important;
  background-image:none!important;
}

/* Keep navigation dark, without changing active states or typography. */
body.workspace-dark-theme:not(.exam-portal) #navbar,
body.workspace-dark-theme:not(.exam-portal) .app-sidebar,
body.workspace-dark-theme:not(.exam-portal) .mobile-menu{
  background:#02070e!important;
  background-image:none!important;
  border-color:var(--workspace-border-soft)!important;
}

/* Match the almost-black My Exams containers instead of the older blue cards. */
body.workspace-dark-theme:not(.exam-portal) .panel,
body.workspace-dark-theme:not(.exam-portal) .card,
body.workspace-dark-theme:not(.exam-portal) .form-card,
body.workspace-dark-theme:not(.exam-portal) .white-card,
body.workspace-dark-theme:not(.exam-portal) .glass-card,
body.workspace-dark-theme:not(.exam-portal) .dashboard-card,
body.workspace-dark-theme:not(.exam-portal) .dashboard-banner,
body.workspace-dark-theme:not(.exam-portal) .quick-admin-card,
body.workspace-dark-theme:not(.exam-portal) .gateway-card,
body.workspace-dark-theme:not(.exam-portal) .info-card,
body.workspace-dark-theme:not(.exam-portal) .stat-card,
body.workspace-dark-theme:not(.exam-portal) .stats-tile,
body.workspace-dark-theme:not(.exam-portal) .mini-panel,
body.workspace-dark-theme:not(.exam-portal) .main-card,
body.workspace-dark-theme:not(.exam-portal) .side-card,
body.workspace-dark-theme:not(.exam-portal) .result-card,
body.workspace-dark-theme:not(.exam-portal) .summary-card,
body.workspace-dark-theme:not(.exam-portal) .content-card,
body.workspace-dark-theme:not(.exam-portal) .app-card,
body.workspace-dark-theme:not(.exam-portal) .student-card,
body.workspace-dark-theme:not(.exam-portal) .payment-card,
body.workspace-dark-theme:not(.exam-portal) .lesson-card,
body.workspace-dark-theme:not(.exam-portal) .student-overview-card,
body.workspace-dark-theme:not(.exam-portal) .student-summary-card,
body.workspace-dark-theme:not(.exam-portal) .quick-link,
body.workspace-dark-theme:not(.exam-portal) .summary-tile,
body.workspace-dark-theme:not(.exam-portal) .question-review-card,
body.workspace-dark-theme:not(.exam-portal) .question-preview-card,
body.workspace-dark-theme:not(.exam-portal) .editor-card,
body.workspace-dark-theme:not(.exam-portal) .modal-box,
body.workspace-dark-theme:not(.exam-portal) .q-modal-card{
  background:#02070e!important;
  background-image:none!important;
  border-color:var(--workspace-border)!important;
}

/* Nested/subtle regions use the slightly raised My Exams tone. */
body.workspace-dark-theme:not(.exam-portal) .empty,
body.workspace-dark-theme:not(.exam-portal) .alert,
body.workspace-dark-theme:not(.exam-portal) .notice,
body.workspace-dark-theme:not(.exam-portal) .panel-subtle,
body.workspace-dark-theme:not(.exam-portal) .upload-box,
body.workspace-dark-theme:not(.exam-portal) .preview-box,
body.workspace-dark-theme:not(.exam-portal) .preview-panel,
body.workspace-dark-theme:not(.exam-portal) .math-preview,
body.workspace-dark-theme:not(.exam-portal) .math-preview-card{
  background:#080d13!important;
  background-image:none!important;
  border-color:var(--workspace-border-soft)!important;
}

/* Tables retain their existing header colour, but body surfaces match My Exams. */
body.workspace-dark-theme:not(.exam-portal) .table-wrap{
  background:#02070e!important;
  background-image:none!important;
  border-color:var(--workspace-border-soft)!important;
}
body.workspace-dark-theme:not(.exam-portal) table,
body.workspace-dark-theme:not(.exam-portal) .data-table,
body.workspace-dark-theme:not(.exam-portal) .saved-table,
body.workspace-dark-theme:not(.exam-portal) .matrix-table{
  background:transparent!important;
}
body.workspace-dark-theme:not(.exam-portal) .data-table td,
body.workspace-dark-theme:not(.exam-portal) .saved-table td,
body.workspace-dark-theme:not(.exam-portal) .matrix-table td,
body.workspace-dark-theme:not(.exam-portal) table tbody td{
  background:#02070e!important;
}
body.workspace-dark-theme:not(.exam-portal) .data-table tr:nth-child(even) td,
body.workspace-dark-theme:not(.exam-portal) .saved-table tr:nth-child(even) td,
body.workspace-dark-theme:not(.exam-portal) table tbody tr:nth-child(even) td{
  background:#040a12!important;
}
body.workspace-dark-theme:not(.exam-portal) .data-table tr:hover td,
body.workspace-dark-theme:not(.exam-portal) .saved-table tr:hover td,
body.workspace-dark-theme:not(.exam-portal) .table-wrap table tr:hover td{
  background:#091321!important;
}

/* Form surfaces only; dimensions, labels and controls stay unchanged. */
body.workspace-dark-theme:not(.exam-portal) input,
body.workspace-dark-theme:not(.exam-portal) select,
body.workspace-dark-theme:not(.exam-portal) textarea,
body.workspace-dark-theme:not(.exam-portal) math-field,
body.workspace-dark-theme:not(.exam-portal) .form-control,
body.workspace-dark-theme:not(.exam-portal) .form-select,
body.workspace-dark-theme:not(.exam-portal) .premium-input,
body.workspace-dark-theme:not(.exam-portal) .premium-select,
body.workspace-dark-theme:not(.exam-portal) .premium-textarea{
  background-color:#050b13!important;
  background-image:none!important;
}


/* Student Workspace completion: Fees & Dues, Payments, Course Content and Downloads.
   Loaded after all legacy styles so these four sections use the approved My Exams surfaces. */
body.student-portal.workspace-dark-theme:not(.exam-portal) .app-main > .panel,
body.student-portal.workspace-dark-theme:not(.exam-portal) .cards-grid > .info-card,
body.student-portal.workspace-dark-theme:not(.exam-portal) .table-wrap,
body.student-portal.workspace-dark-theme:not(.exam-portal) .data-table tbody td,
body.student-portal.workspace-dark-theme:not(.exam-portal) .info-card .kv,
body.student-portal.workspace-dark-theme:not(.exam-portal) .form-field input,
body.student-portal.workspace-dark-theme:not(.exam-portal) .form-field select,
body.student-portal.workspace-dark-theme:not(.exam-portal) .form-field textarea {
  background:#02070e!important;
  background-image:none!important;
  border-color:rgba(201,150,26,.38)!important;
}
body.student-portal.workspace-dark-theme:not(.exam-portal) .cards-grid > .info-card {
  box-shadow:none!important;
}
body.student-portal.workspace-dark-theme:not(.exam-portal) .info-card .kv {
  border-bottom-color:rgba(201,150,26,.18)!important;
}
body.student-portal.workspace-dark-theme:not(.exam-portal) .data-table tbody tr:nth-child(even) td {
  background:#040a12!important;
}
body.student-portal.workspace-dark-theme:not(.exam-portal) .data-table tbody tr:hover td {
  background:#091321!important;
}


/* Final dark-surface consistency pass: keep approved card colour on hover and
   cover legacy dashboard tile/card class names that still used the old blue. */
body.workspace-dark-theme:not(.exam-portal) :is(
  .card,.panel,.glass-card,.info-card,.feature-card,.dashboard-card,.quick-admin-card,
  .stat-card,.stats-card,.stats-tile,.stat-box,.kpi,.metric-card,.summary-card,.summary-tile,
  .portal-box,.content-card,.app-card,.student-card,.payment-card,.lesson-card,.result-card,
  .main-card,.side-card,.white-card,.form-card,.gateway-card,.mini-panel,.quick-link,
  .student-overview-card,.student-summary-card,.dashboard-banner,.action-card,.service-card,
  .overview-card,.analytics-card,.report-card,.admin-card,.workspace-card,.data-card,
  [class*="metric-card"],[class*="stat-card"],[class*="summary-card"],[class*="dashboard-card"],
  [class*="quick-card"],[class*="overview-card"],[class*="analytics-card"]
){
  background:#02070e!important;
  background-image:none!important;
  border-color:var(--workspace-border)!important;
}
body.workspace-dark-theme:not(.exam-portal) :is(
  .card,.panel,.glass-card,.info-card,.feature-card,.dashboard-card,.quick-admin-card,
  .stat-card,.stats-card,.stats-tile,.stat-box,.kpi,.metric-card,.summary-card,.summary-tile,
  .portal-box,.content-card,.app-card,.student-card,.payment-card,.lesson-card,.result-card,
  .main-card,.side-card,.white-card,.form-card,.gateway-card,.mini-panel,.quick-link,
  .student-overview-card,.student-summary-card,.dashboard-banner,.action-card,.service-card,
  .overview-card,.analytics-card,.report-card,.admin-card,.workspace-card,.data-card,
  [class*="metric-card"],[class*="stat-card"],[class*="summary-card"],[class*="dashboard-card"],
  [class*="quick-card"],[class*="overview-card"],[class*="analytics-card"]
):hover{
  background:#02070e!important;
  background-image:none!important;
}
body.workspace-dark-theme:not(.exam-portal) :is(
  .card,.panel,.glass-card,.info-card,.feature-card,.dashboard-card,.quick-admin-card,
  .stat-card,.stats-card,.stats-tile,.stat-box,.kpi,.metric-card,.summary-card,.summary-tile,
  .portal-box,.content-card,.app-card,.student-card,.payment-card,.lesson-card,.result-card,
  .main-card,.side-card,.white-card,.form-card,.gateway-card,.mini-panel,.quick-link,
  .student-overview-card,.student-summary-card,.dashboard-banner,.action-card,.service-card,
  .overview-card,.analytics-card,.report-card,.admin-card,.workspace-card,.data-card
)::before,
body.workspace-dark-theme:not(.exam-portal) :is(
  .card,.panel,.glass-card,.info-card,.feature-card,.dashboard-card,.quick-admin-card,
  .stat-card,.stats-card,.stats-tile,.stat-box,.kpi,.metric-card,.summary-card,.summary-tile,
  .portal-box,.content-card,.app-card,.student-card,.payment-card,.lesson-card,.result-card,
  .main-card,.side-card,.white-card,.form-card,.gateway-card,.mini-panel,.quick-link,
  .student-overview-card,.student-summary-card,.dashboard-banner,.action-card,.service-card,
  .overview-card,.analytics-card,.report-card,.admin-card,.workspace-card,.data-card
)::after{
  background-color:transparent!important;
}

/* Final remaining-surface completion: all portal dashboard/form/report cards use the
   approved near-black My Exams surface, including structures whose legacy class
   names do not contain "card". The active Exam page remains excluded. */
body.workspace-dark-theme:not(.exam-portal) :is(
  .stat-grid > *, .stats-strip > *, .admin-quick-grid > *, .cards-grid > *,
  .analytics-quad-grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > *,
  .question-premium-panel, .question-bank-shell, .reset-link-card,
  .fee-card, .ledger-card, .incident-card, .action-panel, .report-panel,
  .question-bank-shell .form-card, .question-bank-shell .q-span-12,
  .question-bank-shell .q-span-8, .question-bank-shell .q-span-5,
  .question-bank-shell .q-span-4, .question-bank-shell .q-span-3
){
  background:#02070e!important;
  background-image:none!important;
  border-color:var(--workspace-border)!important;
}
body.workspace-dark-theme:not(.exam-portal) :is(
  .stat-grid > *, .stats-strip > *, .admin-quick-grid > *, .cards-grid > *,
  .analytics-quad-grid > *, .grid-2 > *, .grid-3 > *, .grid-4 > *,
  .question-premium-panel, .question-bank-shell, .reset-link-card,
  .fee-card, .ledger-card, .incident-card, .action-panel, .report-panel
):hover{
  background:#02070e!important;
  background-image:none!important;
}
body.workspace-dark-theme:not(.exam-portal) .question-bank-shell .form-card,
body.workspace-dark-theme:not(.exam-portal) .question-bank-shell .form-card:hover{
  background:#02070e!important;
  background-image:none!important;
  box-shadow:none!important;
}


/* FINAL LIVE PROCTOR SURFACE + TIMELINE CHIP HOVER FIX
   Scope is intentionally limited to the last remaining proctor cards and
   Grouped/Live Stream view controls. */
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-insights > .ai-insight-card,
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-insights > .ai-insight-card:hover,
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-insights > .panel.ai-insight-card,
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-insights > .panel.ai-insight-card:hover{
  background:#02070e!important;
  background-color:#02070e!important;
  background-image:none!important;
  border-color:rgba(201,150,26,.38)!important;
  box-shadow:none!important;
}
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-insights .ai-insight-card .empty{
  background:#080d13!important;
  background-image:none!important;
}

/* Timeline view buttons: retain selected-state meaning and add the same
   premium lift/glow feedback used by other portal controls. */
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-toolbar .proctor-filter-chips .proctor-chip{
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease!important;
}
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-toolbar .proctor-filter-chips .proctor-chip:not(.active):hover,
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-toolbar .proctor-filter-chips .proctor-chip:not(.active):focus-visible{
  transform:translateY(-2px)!important;
  background:rgba(240,192,64,.16)!important;
  border-color:rgba(255,212,77,.82)!important;
  color:#fff3c4!important;
  -webkit-text-fill-color:#fff3c4!important;
  box-shadow:0 10px 24px rgba(216,165,28,.18)!important;
  outline:none!important;
}
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-toolbar .proctor-filter-chips .proctor-chip.active:hover,
body.admin-portal.workspace-dark-theme:not(.exam-portal) .ai-proctor-toolbar .proctor-filter-chips .proctor-chip.active:focus-visible{
  transform:translateY(-2px)!important;
  filter:brightness(1.06)!important;
  box-shadow:0 12px 26px rgba(240,192,64,.28)!important;
  outline:none!important;
}


/* FINAL TRANSITION + OVERLAY DARK PAINT
   Prevents the legacy blue surface from flashing while portal pages change. */
html:has(body.workspace-dark-theme),
html:has(body.exam-portal){background:#01050a!important;background-image:none!important;}
body.workspace-dark-theme,
body.workspace-dark-theme::before{
  background-color:#01050a!important;
  background-image:none!important;
}
body.workspace-dark-theme .page-loader,
body.workspace-dark-theme .loading-overlay,
body.workspace-dark-theme .import-overlay,
body.workspace-dark-theme .astra-import-overlay,
body.workspace-dark-theme .fullscreen-gate,
body.workspace-dark-theme .completion-overlay{
  background-color:rgba(1,5,10,.94)!important;
  background-image:none!important;
}
body.workspace-dark-theme .loader-card,
body.workspace-dark-theme .loading-card,
body.workspace-dark-theme .astra-import-card,
body.workspace-dark-theme .completion-card,
body.workspace-dark-theme .fullscreen-card{
  background:#02070e!important;
  background-image:none!important;
}


/* ADMIN LOGIN EXACT SURFACE FIX */
body.admin-login-page.workspace-dark-theme .login-showcase > .login-side-card,
body.admin-login-page.workspace-dark-theme .login-showcase > .panel.login-side-card,
body.admin-login-page.workspace-dark-theme .login-feature-list,
body.admin-login-page.workspace-dark-theme .login-feature-item{
  background:#02070e!important;
  background-color:#02070e!important;
  background-image:none!important;
}
