:root{
  /* Material 3–inspired system colors */
  --md-sys-color-primary: #2563eb;
  --md-sys-color-primary-container: #e0edff;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-secondary: #0f766e;
  --md-sys-color-surface: #f9fafb;
  --md-sys-color-surface-variant: #eef2ff;
  --md-sys-color-outline: #d1d5db;
  --md-sys-color-outline-variant: #e5e7eb;
  --md-sys-color-on-surface: #111827;
  --md-sys-color-on-surface-variant: #4b5563;
  --md-sys-color-error: #dc2626;

  /* Elevation tokens */
  --pm-elevation-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.10);
  --pm-elevation-2: 0 4px 8px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.08);

  /* Sidebar + layout */
  --pm-sb-bg: #ffffff;
  --pm-sb-border: #e5e7eb;
  --pm-sb-muted: #6b7280;
  --pm-sb-active-bg: var(--md-sys-color-primary-container);
  --pm-sb-active-text: var(--md-sys-color-primary);
  --pm-sb-hover: #f3f4ff;
  --pm-sb-radius: 16px;
  --pm-top-h: 64px;

  /* Typography */
  --pm-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pm-radius-lg: 16px;
  --pm-radius-md: 12px;
}

body{
  font-family: var(--pm-font-sans);
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
}

/* App header (only used in app shell) */
.pm-app-header{
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(249, 250, 251, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
.pm-app-header-inner{
  height: var(--pm-top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.pm-app-header-left{
  display: flex;
  align-items: center;
  gap: 12px;
}
.pm-app-brand{
  text-decoration: none;
  color: #111827;
  line-height: 1.1;
}
.pm-app-brand-name{
  display: block;
  font-weight: 800;
  font-size: 14px;
}
.pm-app-brand-sub{
  display: block;
  font-size: 12px;
  color: var(--pm-sb-muted);
}
.pm-app-header-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* App shell wrapper should be full width */
.pm-main-wrap{
  padding: 0;
}

/* App Shell layout (sidebar attached to left wall) */
.pm-app{
  position: relative;
}

.pm-overlay{
  display: none;
}

.pm-sidebar{
  position: fixed;
  left: 0;
  top: var(--pm-top-h);
  bottom: 0;
  width: 290px;
  transition: width .18s ease, transform .18s ease;
  padding: 12px;
  z-index: 1020;
}

.pm-main{
  margin-left: 290px;
  padding: 20px 22px;
  min-width: 0;
}

/* Desktop collapsed sidebar (icons-only) */
.pm-app.pm-collapsed .pm-sidebar{
  width: 78px;
}
.pm-app.pm-collapsed .pm-main{
  margin-left: 78px;
}
.pm-app.pm-collapsed .pm-sb-label,
.pm-app.pm-collapsed .pm-sb-caret,
.pm-app.pm-collapsed .pm-sb-group{
  display: none !important;
}

/* Collapsed: hide brand text and center everything */
.pm-app.pm-collapsed .pm-sb-header{
  justify-content: center;
  padding: 12px 10px;
}
.pm-app.pm-collapsed .pm-sb-brand{
  display: none !important;
}
.pm-app.pm-collapsed .pm-sb-body{
  padding: 10px 8px;
}
.pm-app.pm-collapsed .pm-sb-item{
  justify-content: center;
  gap: 0;
  padding: 10px 8px;
}
.pm-app.pm-collapsed .pm-sb-item .pm-sb-ico{
  margin: 0 auto;
}
.pm-app.pm-collapsed .pm-sb-divider{
  margin: 10px 2px;
}

/* Sidebar visuals */
.pm-sb{
  height: 100%;
  background: var(--pm-sb-bg);
  border: 1px solid var(--pm-sb-border);
  border-radius: var(--pm-sb-radius);
  box-shadow: var(--pm-elevation-2);
  display: flex;
  flex-direction: column;
}

.pm-sb-header{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--pm-sb-border);
}

.pm-sb-logo{
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--pm-sb-border);
  background: #fff;
  object-fit: contain;
}

.pm-sb-brand{
  line-height: 1.1;
}
.pm-sb-brand .name{
  font-weight: 800;
  font-size: 14px;
}
.pm-sb-brand .sub{
  font-size: 12px;
  color: var(--pm-sb-muted);
}

.pm-sb-body{
  padding: 10px;
  overflow: auto;
}

.pm-sb-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 999px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  font-weight: 600;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.pm-sb-item:hover{
  background: var(--pm-sb-hover);
  transform: translateY(-1px);
}

.pm-sb-item .pm-sb-ico{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #64748b;
  background: #f3f4ff;
  border: 1px solid var(--pm-sb-border);
  flex: 0 0 36px;
}

.pm-sb-item.active{
  background: var(--pm-sb-active-bg);
  color: var(--pm-sb-active-text);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.pm-sb-item.active .pm-sb-ico{
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--pm-sb-active-text);
}

.pm-sb-divider{
  height: 1px;
  background: var(--pm-sb-border);
  margin: 10px 6px;
}

/* Group (dropdown) */
.pm-sb-group-toggle{
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.pm-sb-caret{
  margin-left: auto;
  color: #94a3b8;
}

.pm-sb-group{
  padding-left: 48px;
  margin-top: 6px;
  display: none;
}

.pm-sb-group a{
  display: block;
  padding: 10px 12px;
  margin: 4px 0;
  border-radius: 10px;
  color: #111827;
  text-decoration: none;
  font-weight: 600;
}

.pm-sb-group a:hover{
  background: var(--pm-sb-hover);
}

.pm-sb-group a.active{
  background: var(--pm-sb-active-bg);
  color: var(--pm-sb-active-text);
}

.pm-sb-group-wrap.open .pm-sb-group{
  display: block;
}

/* Mobile: sidebar becomes offcanvas */
@media (max-width: 991.98px){
  .pm-sidebar{
    transform: translateX(-110%);
    width: 290px;
    padding: 12px;
  }
  .pm-main{
    margin-left: 0;
    padding: 14px;
  }
  .pm-app.pm-collapsed .pm-sidebar{
    width: 290px; /* ignore collapsed icons-only on mobile */
  }
  .pm-app.pm-collapsed .pm-main{
    margin-left: 0;
  }
  .pm-app.pm-mobile-open .pm-sidebar{
    transform: translateX(0);
  }
  .pm-overlay{
    display: none;
  }
  .pm-app.pm-mobile-open .pm-overlay{
    display: block;
    position: fixed;
    left: 0;
    top: var(--pm-top-h);
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, .35);
    z-index: 1015;
  }
}

/* Modal reliability (helps on small screens in the app shell) */
.modal-dialog-scrollable .modal-body{
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Let Bootstrap manage modal height/scroll; we only enhance small-screen fullscreen */
@media (max-width: 575.98px){
  .modal-fullscreen-sm-down .modal-content{
    border-radius: 0;
  }
}

/* Paper Generator Wizard Styles */
.pm-wizard-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 24px;
  color: white;
  margin-bottom: 24px;
}

.pm-wizard-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.pm-wizard-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
}

.pm-breadcrumb-item {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.pm-breadcrumb-sep {
  color: rgba(255, 255, 255, 0.6);
  margin: 0 4px;
}

/* Progress Tracker */
.pm-progress-tracker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  position: relative;
  padding: 0 20px;
}

.pm-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
}

.pm-step-clickable {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.pm-step-clickable:hover {
  transform: translateY(-2px);
}

.pm-step-clickable:hover .pm-step-circle {
  transform: scale(1.05);
}

.pm-step-clickable.pending:hover .pm-step-circle {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.pm-step-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.pm-step.completed .pm-step-circle {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.pm-step.active .pm-step-circle {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
  transform: scale(1.1);
}

.pm-step.pending .pm-step-circle {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Clickable step styles */
.pm-step-clickable {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.pm-step-clickable:hover {
  transform: translateY(-2px);
}

.pm-step-clickable:hover .pm-step-circle {
  transform: scale(1.05);
}

.pm-step-clickable.pending:hover .pm-step-circle {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.pm-step-clickable.active .pm-step-circle {
  transform: scale(1.1);
}

.pm-step-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.pm-step.completed .pm-step-label,
.pm-step.active .pm-step-label {
  color: white;
}

.pm-step.pending .pm-step-label {
  color: rgba(255, 255, 255, 0.6);
}

.pm-step-connector {
  flex: 1;
  height: 3px;
  margin: 0 8px;
  position: relative;
  top: -24px;
  z-index: 1;
  transition: all 0.3s ease;
}

.pm-step-connector.completed {
  background: #10b981;
}

.pm-step-connector.active {
  background: linear-gradient(to right, #10b981 0%, #3b82f6 100%);
}

.pm-step-connector.pending {
  background: rgba(255, 255, 255, 0.2);
}

/* Selection Cards */
.pm-selection-card {
  position: relative;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--pm-radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.pm-selection-card:hover {
  border-color: var(--md-sys-color-primary);
  transform: translateY(-4px);
  box-shadow: var(--pm-elevation-2);
}

.pm-selection-card.selected {
  border-color: var(--md-sys-color-primary);
  background: linear-gradient(135deg, #e0edff 0%, #e5f3ff 100%);
  box-shadow: var(--pm-elevation-2);
}

.pm-card-icon {
  font-size: 48px;
  color: #3b82f6;
  margin-bottom: 12px;
  transition: transform 0.3s ease;
}

.pm-selection-card:hover .pm-card-icon {
  transform: scale(1.1);
}

.pm-selection-card.selected .pm-card-icon {
  color: #1e40af;
}

.pm-card-title {
  font-weight: 700;
  font-size: 16px;
  color: #111827;
  margin-bottom: 4px;
}

.pm-card-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.pm-card-check {
  position: absolute;
  top: 12px;
  right: 12px;
  color: #10b981;
  font-size: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pm-selection-card.selected .pm-card-check {
  opacity: 1;
}

.pm-chapter-card {
  min-height: 140px;
}

/* Step 3: topic panels stay visible; unit must be selected to enable picks */
.pm-unit-topic-picks.pm-unit-topic-picks--disabled {
  opacity: 0.72;
}

/* Step 5: question row disabled when quota reached (cannot select more) */
.pm-question-over-quota {
  opacity: 0.6;
  pointer-events: none;
}
.pm-question-over-quota .form-check-label {
  cursor: not-allowed;
}

/* Step Content */
.pm-step-content {
  background: #ffffff;
  border-radius: var(--pm-radius-lg);
  padding: 32px;
  box-shadow: var(--pm-elevation-1);
}

/* MCQ Options - Horizontal Layout */
.pm-mcq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.pm-mcq-option {
  white-space: nowrap;
  padding: 4px 8px;
}

/* Editable Paper Content */
#pmPaperContent[contenteditable="true"] {
  outline: 2px dashed #3b82f6;
  outline-offset: 4px;
  min-height: 200px;
  padding: 16px;
}

#pmPaperContent[contenteditable="true"]:focus {
  outline-color: #2563eb;
}

/* Responsive */
@media (max-width: 991.98px) {
  .pm-progress-tracker {
    padding: 0 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .pm-step {
    min-width: 80px;
    flex-shrink: 0;
  }
  
  .pm-step-label {
    font-size: 11px;
  }
  
  .pm-wizard-header {
    padding: 20px;
  }
  
  .pm-step-content {
    padding: 24px;
  }
}

@media (max-width: 575.98px) {
  .pm-selection-card {
    min-height: 140px;
    padding: 20px;
  }
  
  .pm-card-icon {
    font-size: 40px;
  }
  
  .pm-step-circle {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

/* School modal UX helpers */
.pm-modal-section-title{
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  margin-top: 2px;
  margin-bottom: 10px;
}
.pm-img-preview{
  width: 96px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--pm-sb-border);
  background: #fff;
  object-fit: contain;
}
.pm-modal-footer-sticky{
  position: sticky;
  bottom: 0;
  background: #ffffff;
  border-top: 1px solid var(--pm-sb-border);
  z-index: 2;
}

/* ---------- Material 3–style cards & controls (global) ---------- */

.card.pm-card{
  border-radius: var(--pm-radius-lg);
  border: 1px solid var(--md-sys-color-outline-variant);
  background-color: #ffffff;
  box-shadow: var(--pm-elevation-1);
}

.card.pm-card .card-header{
  border-bottom-color: var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-variant);
  font-weight: 600;
}

.card.pm-card .card-body{
  padding: 20px 20px;
}

/* Buttons */
.btn-primary{
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,0.18);
}

.btn-primary:hover{
  background-color: #1d4ed8;
  border-color: #1d4ed8;
}

.btn-outline-primary{
  border-radius: 999px;
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-primary);
}

.btn-outline-primary:hover{
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-primary);
}

.btn-danger{
  border-radius: 999px;
}

/* Inputs */
.form-control,
.form-select{
  border-radius: 999px;
  border-color: var(--md-sys-color-outline);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.form-control:focus,
.form-select:focus{
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

label.form-label{
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

/* Tables */
.table thead tr{
  background-color: var(--md-sys-color-surface-variant);
}

.table thead th{
  border-bottom-color: var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.table tbody tr:hover{
  background-color: #f9fafb;
}

/* Badges (used as chips) */
.badge{
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}



