/* Professional Report Card Design System */
:root {
  --primary: #1e3a8a;
  --primary-dark: #0f172a;
  --primary-light: #3b82f6;
  --accent: #059669;
  --accent-light: #10b981;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-header: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #cbd5e1;
  --border-dark: #334155;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 6px;
  --border-radius-lg: 8px;
}

@media print {
  :root {
    --primary: #1e3a8a;
    --primary-dark: #0f172a;
    --primary-light: #3b82f6;
    --accent: #059669;
    --accent-light: #10b981;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-header: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --border-dark: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 6px;
    --border-radius-lg: 8px;
  }
}

/* Print optimizations: make the report readable while keeping it printable */
@page { size: A4 portrait; margin: 8mm; page-break-after: avoid; }
@media print {
  html, body {
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  body {
    font-size: 11pt !important;
    line-height: 1.25;
    color: #111827;
  }
  .report-container {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    box-sizing: border-box;
    margin: 0;
    padding: 10mm;
    overflow: visible !important;
    transform: none !important;
    page-break-inside: avoid !important;
    page-break-after: avoid !important;
    border-bottom: 2px solid #334155;
  }
  .report-header { padding: 8px !important; }
  .school-logo { max-width: 78px !important; height: auto !important; }
  .student-photo { max-width: 96px !important; max-height: 110px !important; }
  .report-header .header-center h2 { font-size: 1.1rem !important; }
  table { font-size: 10.5pt !important; }
  table th, table td { padding: 5px 8px !important; }
  .student-info td { font-size: 10pt !important; }
  .approval-section { padding: 6px 8px !important; margin-top: 4px !important; margin-bottom: 8px !important; border: none !important; box-shadow: none !important; page-break-inside: avoid !important; }
  .signature-box { min-height: 60px !important; padding: 6px !important; border: none !important; box-shadow: none !important; background: transparent !important; }
  .signature-image { max-width: 90px !important; border: none !important; box-shadow: none !important; }
  .signature-name { font-size: 1.2rem !important; margin-bottom: 0.7rem !important; }
  .report-footer, .global-actions { display: none !important; }
  .print-badge { display: none !important; }
  .report-container, #reportSection, .score-table, .approval-section { page-break-inside: avoid !important; page-break-after: avoid; }
}

.approval-columns {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
  justify-content: center;
  padding: 0 1rem;
}
.approval-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 220px;
}
.approval-label {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
  width: 100%;
}
.signature-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
  width: 200px;
  max-width: 100%;
  min-height: 90px;
  height: auto;
  overflow: visible;
  margin: 0 auto 0.4rem auto;
  border-radius: 4px;
  padding: 0.2rem 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}

.approval-col .signature-box {
  width: 200px;
  max-width: 200px;
}

.signature-line {
  width: 200px;
  max-width: 100%;
  border-bottom: 2px solid var(--border-dark);
  margin: 0.25rem auto 0 auto;
  position: relative;
}

.approval-col .signature-box {
  width: 240px;
  max-width: 240px;
}

.signature-line {
  width: 240px;
  max-width: 100%;
  border-bottom: 2px solid var(--border-dark);
  margin: 0.25rem auto 0 auto;
  position: relative;
}
.signature-name {
  width: 100%;
  text-align: center;
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Dancing Script', 'Brush Script MT', 'Lucida Handwriting', 'Segoe Script', 'Zapfino', cursive !important;
  font-size: 2rem !important;
  font-weight: 400;
  color: #111827;
  margin-bottom: 0.35rem;
  line-height: 1.0;
  letter-spacing: 0.08em;
  text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border: none;
  background: transparent;
}
.signature-image {
  width: 100%;
  height: auto;
  max-height: 90px;
  object-fit: contain;
  object-position: center;
  display: block;
  border: none !important;
  box-shadow: none !important;
}

/* Make headteacher signature black & white (screen + print) */
#headteacherSignature,
.headteacher-signature-img {
  -webkit-filter: grayscale(100%) contrast(1) brightness(1) !important;
  filter: grayscale(100%) contrast(1) brightness(1) !important;
  /* ensure it prints desaturated on browsers that honor print-color-adjust */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.signature-line {
  width: 240px;
  max-width: 95%;
  border-bottom: 2px solid var(--border-dark);
  margin: 0.25rem auto 0 auto;
  position: relative;
}
.signature-line::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 20%, var(--primary) 80%, transparent 100%);
}

/* Underline signature text for class teacher and headteacher */
.signature-label {
  text-decoration: underline;
  text-underline-position: under;
  white-space: nowrap;
  position: relative;
}
#classTeacherName, #headteacherName {
  position: absolute;
  top: -0.45rem;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 0 0.5rem;
  z-index: 1;
  text-transform: capitalize;
}
.signature-label {
  font-size: 0.85rem;
  color: #555;
  margin-top: 0.2rem;
  font-weight: normal;
}

/* Approval Section - Modernized Design */
.approval-section {
  margin-bottom: 0.5rem;
  margin-top: -0.8rem;
  padding: 0.5rem 0.75rem;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.approval-columns {
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
}

.approval-col {
  flex: 1;
  text-align: center;
}

.approval-label {
  font-size: 0.70rem;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.signature-box {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 0.4rem;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.signature-name {
  font-family: 'Dancing Script', 'Brush Script MT', 'Lucida Handwriting', 'Segoe Script', 'Zapfino', cursive;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  font-weight: 400;
  margin-bottom: 0.6rem;
  line-height: 1.0;
  text-transform: capitalize;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.signature-line {
  width: 100px;
  border-bottom: 1px solid #334155;
  margin-top: 0.2rem;
}

.signature-image {
  max-width: 60px;
  height: auto;
  margin-bottom: 0.15rem;
  border: none !important;
  box-shadow: none !important;
}

.motto-under-message,
#encouragementMessage {
  text-align: center;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: #334155;
}


.approval-content {
  max-width: 100%;
}

.approval-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.approval-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.approval-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.15);
}

.approval-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #059669);
}

.headteacher-card::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.card-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.role-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

/* Overrides requested: hide encouragement and motto */
#encouragementMessage, .motto-under-message { display: none !important; }
.signature-box { border: none !important; box-shadow: none !important; background: transparent !important; }

/* Signature line underline for approvals */
.signature-line {
  width: 240px;
  max-width: 95%;
  border-bottom: 2px solid #334155;
  margin: 0.5rem auto 0 auto;
  position: relative;
  display: block !important;
}

.card-header h4 {
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.signature-area {
  text-align: center;
  margin-bottom: 1.25rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.teacher-signature {
  font-family: 'Dancing Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
  font-size: 1.4rem;
  font-weight: 400;
  color: #1f2937;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
  position: relative;
}

.teacher-signature::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #374151, transparent);
}

.headteacher-signature-img {
  max-width: 120px;
  height: auto;
  opacity: 0.9;
  filter: contrast(1.1) brightness(0.95);
  border-radius: 4px;
}

.signature-decoration {
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6b7280, transparent);
  border-radius: 1px;
  margin-top: 0.25rem;
  position: relative;
}

.signature-decoration::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #6b7280;
  border-radius: 50%;
  opacity: 0.6;
}

.signature-decoration::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #6b7280;
  border-radius: 50%;
  opacity: 0.6;
}

.approval-stamp {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.stamp-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.headteacher-card .stamp-circle {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.stamp-text {
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1.1;
}

.encouragement-section {
  text-align: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.encouragement-quote {
  margin-bottom: 1rem;
}

#encouragementMessage {
  font-style: italic;
  color: #4b5563;
  font-size: 1.1rem;
  line-height: 1.4;
  position: relative;
  display: inline-block;
}

#encouragementMessage::before,
#encouragementMessage::after {
  content: '"';
  font-size: 2rem;
  color: #9ca3af;
  position: relative;
  top: -5px;
}

.school-motto {
  color: #1f2937;
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-top: 2px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 1rem;
}


#encouragementMessage {
  text-align: center;
  font-style: italic;
  color: var(--accent);
  font-size: 1.1rem;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--accent);
}

/* A4 print constraints for report dashboard */
@page {
  size: A4 portrait;
  margin: 10mm;
}

@media print {
  html, body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* Override gradients to solid colors for consistent print appearance */
  .report-container {
    background: #ffffff !important;
  }

  .report-header {
    background: #f8fafc !important;
  }

  /* Ensure signature stays desaturated in print */
  #headteacherSignature, .headteacher-signature-img {
    -webkit-filter: grayscale(100%) !important;
    filter: grayscale(100%) !important;
  }

  .student-info {
    background: #ffffff !important;
  }

  .score-table table {
    background: #ffffff !important;
  }

  .remarks {
    background: #ffffff !important;
  }

  .approval-section {
    background: #ffffff !important;
  }

  .dashboard-overview {
    background: #ffffff !important;
  }

  .student-selector {
    background: #ffffff !important;
  }

  .report-footer {
    background: #ffffff !important;
  }

  .report-container {
    width: 210mm;
    min-height: 297mm;
    padding: 10mm;
    margin: 0;
    border: none !important;
    box-shadow: none !important;
  }

  .report-header,
  .student-info,
  .score-table,
  .remarks,
  .approval-section,
  .reports-summary {
    page-break-inside: avoid;
  }

  .score-table td,
  .score-table th {
    font-size: 10px !important;
    line-height: 1.2 !important;
  }

  .approval-section,
  .approval-columns,
  .approval-col,
  .signature-box,
  .signature-name,
  .signature-line {
    page-break-inside: avoid;
  }

  .print-badge,
  #backToReportBtn,
  #backToAdminBtn,
  .student-selector,
  #dashboardOverview {
    display: none !important;
  }

  .signature-name {
    font-family: 'Dancing Script', 'Brush Script MT', 'Lucida Handwriting', cursive !important;
    font-size: 1.8rem !important;
    letter-spacing: 0.05em;
    color: #0f172a !important;
  }

  .signature-line {
    border-bottom: 1.6px solid #334155 !important;
    width: 180px !important;
    margin: 0.3rem auto 0 auto;
  }

  @page {
    size: A4 portrait;
    margin: 10mm;
  }
}

.motto-under-message {
  text-align: center;
  font-weight: bold;
  color: var(--primary);
  font-size: 1rem;
  margin-top: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
/* Hide page number and URL when printing */
@page {
  margin: 20mm;
  size: auto;
}

@media print {
          .report-container {
            margin-top: 0 !important;
            margin-bottom: 0 !important;
          }
        .report-container {
          margin-top: 10mm !important;
        }
      @page { size: A4 portrait; margin: 0; }
    .report-container {
      border-top: 2px solid #222 !important;
      border-right: 2px solid #222 !important;
      border-bottom: 0px solid #222 !important;
      border-left: 2px solid #222 !important;
      box-shadow: none !important;
    }
  /* Remove default browser header/footer (page number, URL) */
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Hide the signature line (horizontal bar) in print preview */
  /* Show signature line in print, but prevent wrapping and underline label */
  .signature-decoration { border-bottom: 2px solid #222 !important; min-width: 140px !important; white-space: nowrap !important; }
  .teacher-signature { text-decoration: underline !important; text-underline-position: under !important; white-space: nowrap !important; font-size: 1.2rem !important; }
  .headteacher-signature-img { max-width: 100px !important; filter: none !important; border: none !important; box-shadow: none !important; }
  #headteacherSignature { border: none !important; box-shadow: none !important; }
  /* Fit the report to the whole sheet for print preview */
  @page { margin: 0; size: A4 portrait; }
}
/* Hide selection controls when printing */
@media print {
  .no-print {
    display: none !important;
  }
}
.back-btn {
  margin-bottom: 1.5rem;
}
/* Dashboard Overview Styles */
.dashboard-overview {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
  z-index: 2;
  border: 2px solid var(--border);
  border-top: 6px solid var(--primary);
}

.dashboard-overview h2 {
  color: var(--primary-dark);
  margin-bottom: 2rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.dashboard-cards {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.dashboard-card {
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 2.5rem;
  min-width: 180px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-card:hover {
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
  border-color: var(--primary);
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.back-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  display: inline-block;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.fixed-action-buttons {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.65rem;
  max-width: calc(100vw - 20px);
}

.fixed-action-buttons .back-btn {
  min-width: 150px;
  margin-top: 0;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .fixed-action-buttons {
    position: static;
    width: auto;
    justify-content: flex-start;
    margin: 1rem 1rem 0;
  }
  .fixed-action-buttons .back-btn {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .dashboard-cards {
    flex-direction: column;
    gap: 1rem;
  }
  .dashboard-card {
    min-width: 100%;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
  }
  .dashboard-overview {
    padding: 1.2rem 0.8rem;
  }
}

/* Class Selector and Bulk Print Button Styles */
.student-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
}

.student-selector label {
  font-weight: bold;
  margin-right: 0.5rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#classSelect, #studentSelect, #termFilter, #yearFilter, #examType {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--border);
  min-width: 180px;
  font-size: 0.95rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}

#classSelect:focus, #studentSelect:focus, #termFilter:focus, #yearFilter:focus, #examType:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

#studentSearch {
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  border: 2px solid var(--border);
  font-size: 0.95rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  min-width: 200px;
}

#bulkPrintBtn, #bulkDownloadBtn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-md);
}

#bulkPrintBtn:hover, #bulkDownloadBtn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
/* Responsive Design for Tablets and Phones */
@media (max-width: 900px) {
  .report-container {
    padding: 1rem;
    max-width: 100%;
    border-radius: 0;
  }
  .report-header {
    gap: 0.7rem;
  }
  .header-center h1 {
    font-size: 1.2rem;
  }
  .header-center h2 {
    font-size: 1rem;
  }
  .school-logo, .header-left, .header-right {
    width: 70px !important;
    height: 85px !important;
    max-width: 70px !important;
    max-height: 85px !important;
  }
  .student-photo {
    width: 70px !important;
    height: 85px !important;
    max-width: 70px !important;
    max-height: 85px !important;
  }
  .score-table th, .score-table td {
    padding: 0.4rem;
    font-size: 0.9rem;
  }

  /* Approval section responsive */
  .approval-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .approval-card {
    padding: 1.25rem;
  }

  .teacher-signature {
    font-size: 1.3rem;
  }
}

@media (max-width: 600px) {
  .report-container {
    padding: 0.3rem;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  .report-header {
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
  }
  .header-left, .header-right {
    width: 60px !important;
    height: 70px !important;
    max-width: 60px !important;
    max-height: 70px !important;
    margin-bottom: 0.3rem;
  }
  .school-logo {
    width: 60px !important;
    height: 70px !important;
    max-width: 60px !important;
    max-height: 70px !important;
    margin-right: 0;
  }
  .student-photo {
    width: 60px !important;
    height: 70px !important;
    max-width: 60px !important;
    max-height: 70px !important;
  }
  .header-center h1 {
    font-size: 1rem;
  }
  .header-center h2 {
    font-size: 0.9rem;
  }
  .header-center .motto {
    font-size: 0.85rem;
  }
  .score-table th, .score-table td {
    padding: 0.25rem;
    font-size: 0.8rem;
  }
  .student-selector select {
    min-width: 120px;
    font-size: 0.9rem;
  }
  .student-info p, .remarks p, .attendance p, .interest-conduct p {
    font-size: 0.95rem;
  }
  .signature-line {
    width: 140px;
  }

  /* Approval section mobile responsive */
  .approval-section {
    padding: 1.5rem 1rem;
    margin: 1.5rem 0;
  }

  .approval-grid {
    gap: 1rem;
  }

  .approval-card {
    padding: 1rem;
  }

  .teacher-signature {
    font-size: 1.2rem;
  }

  .stamp-circle {
    width: 70px;
    height: 70px;
  }

  .stamp-text {
    font-size: 0.65rem;
  }

  .encouragement-section {
    padding: 1rem;
  }

  #encouragementMessage {
    font-size: 1rem;
  }
}
/* Reset & Base */@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Times New Roman', 'Georgia', serif;
}

body {
  background-color: #f8fafc;
  color: var(--text-primary);
  padding: 1.5rem;
  line-height: 1.5;
}

/* Container */
.report-container {
  max-width: 900px;
  margin: 1.5rem auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.99) 100%);
  padding: 2.2rem;
  border-radius: 1.1rem;
  box-shadow: 0 20px 38px rgba(15, 23, 42, 0.2), 0 8px 16px rgba(15, 23, 42, 0.12);
  position: relative;
  border: 1px solid rgba(53, 94, 212, 0.25);
  border-top: 8px solid var(--primary);
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.report-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 26px 45px rgba(15, 23, 42, 0.25), 0 12px 24px rgba(15, 23, 42, 0.16);
}

/* Optional watermark */
.report-container::before {
  content: "Nkawkaw Nsuta M/A 'B'";
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: 0.25em;
  color: rgba(15, 23, 42, 0.04);
  pointer-events: none;
  z-index: 0;
}

.report-container * {
  position: relative;
  z-index: 1;
}

/* Header Layout */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-header) 0%, var(--bg-secondary) 100%);
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-center {
  flex: 1;
  text-align: center;
  padding: 0 1rem;
}

.header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.school-logo {
  width: 120px;
  height: 140px;
  object-fit: contain;
  border-radius: var(--border-radius);
  background: var(--bg-primary);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.student-photo {
  width: 120px;
  height: 140px;
  object-fit: fill;
  border-radius: var(--border-radius);
  border: 3px solid var(--border-dark);
  background: var(--bg-primary);
  box-shadow: var(--shadow-md);
}

.ges-header {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.25rem;
}

.school-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.school-address {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.school-contact {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.school-contact a {
  color: var(--primary);
  text-decoration: none;
}

.school-contact a:hover {
  text-decoration: underline;
}

.motto-header-dup {
  font-size: 1rem;
  font-weight: bold;
  color: var(--accent);
  font-style: italic;
  margin-top: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.report-header h2 {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--primary-dark);
  margin-top: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-top: 2px solid var(--accent);
  padding-top: 0.5rem;
}

/* Student Selector */
.student-selector {
  margin-bottom: 1.5rem;
  text-align: center;
}

.student-selector label {
  font-weight: bold;
  margin-right: 0.5rem;
}

.student-selector select {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  min-width: 200px;
}

/* Student Info */
.student-info {
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.student-info table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.student-info td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

.student-info td:nth-child(odd) {
  background: var(--bg-header);
  font-weight: bold;
  color: var(--text-primary);
  width: 35%;
}

.student-info td:nth-child(even) {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Score Tables */
.score-table {
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.score-table table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.9rem;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  border: 1px solid #cbd5e1;
}

.score-table th {
  background: #1e3a8a;
  color: white;
  padding: 1rem 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  border: 1px solid #0f172a;
}

.results-details-header {
  background: #059669 !important;
  font-size: 1rem !important;
  padding: 1.2rem 0.75rem !important;
  color: white !important;
}

.score-table td {
  padding: 0.75rem 0.5rem;
  border: 1px solid #cbd5e1;
  text-align: center;
  font-weight: 500;
  color: #0f172a;
}

.score-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.score-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.score-table tbody tr:hover {
  background: #f1f5f9;
  transition: background-color 0.2s ease;
}

.score-table tfoot {
  background: #f8fafc;
  font-weight: bold;
}

.score-table tfoot td {
  background: transparent;
  color: var(--primary-dark);
  font-weight: bold;
  font-size: 0.95rem;
  padding: 1rem 0.5rem;
  border-top: 2px solid var(--border-dark);
}

@media print {
  .score-table table {
    font-size: 10pt !important;
    margin-bottom: 0.3em !important;
    font-weight: normal !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  /* Keep the main table header blue except for the results-details header which should remain green */
  .score-table th:not(.results-details-header) {
    background: #1e3a8a !important;
    color: white !important;
    border: 1px solid #0f172a !important;
    padding: 1rem 0.75rem !important;
    font-weight: bold !important;
  }
  .score-table td {
    padding: 0.75rem 0.5rem !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    background: inherit !important;
    font-weight: normal !important;
  }
  .score-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
  }
  .score-table tbody tr:nth-child(odd) {
    background: #ffffff !important;
  }
  .score-table tbody tr:hover {
    background: inherit !important;
  }
  .results-details-header {
    background: #059669 !important;
    color: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .score-table tfoot {
    background: #f8fafc !important;
  }
  .score-table tfoot td {
    background: transparent !important;
    color: #0f172a !important;
  }
}

/* Remarks Section */
.remarks {
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 1;
  padding: 0.75rem 0 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.remarks table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  background: transparent;
}

.remarks td {
  padding: 0.45rem 0.5rem;
  border: none;
  background: transparent;
  vertical-align: top;
}

.remarks td:nth-child(odd) {
  background: transparent;
  font-weight: 700;
  color: var(--text-primary);
  width: 22%;
  white-space: nowrap;
}

.remarks td:nth-child(even) {
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid #e2e8f0;
}

.remarks p {
  margin: 0.2rem 0 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.45;
  padding-top: 0.2rem;
}

.remarks strong {
  color: var(--primary-dark);
  font-weight: 700;
}

/* Signature Line */
.signature-line {
  margin-top: 1rem;
  border-top: 1px solid #333;
  width: 250px;
  height: 2px;
}

/* Footer */
.report-footer {
  text-align: center;
  position: relative;
  z-index: 1;
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--border);
}

.report-footer.global-actions {
  margin-top: 1rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border: 2px solid var(--primary-dark);
}

.report-footer.global-actions button {
  background: white !important;
  color: var(--primary-dark) !important;
  border: 2px solid white !important;
  margin: 0 0.5rem;
}

.report-footer button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border: none;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.report-footer button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Print Styles - Optimized for readability and A4 fit */
@media print {
  @page {
    size: A4 portrait;
    margin: 6mm;
  }

  body {
    background: none;
    padding: 0;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    font-size: 9.5pt;
    line-height: 1.05;
  }

  .report-container {
    box-shadow: none !important;
    border: 2px solid #334155 !important;
    border-top: 5px solid #1e3a8a !important;
    padding: 6mm !important;
    margin: 0 !important;
    max-width: none !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    width: 100% !important;
    height: auto !important;
    font-size: 9pt !important;
    overflow: hidden !important;
  }

  .student-selector,
  .report-footer,
  .dashboard-overview,
  .back-btn {
    display: none !important;
  }

  .report-container::before {
    display: none !important;
  }

  /* Header optimization */
  .report-header {
    margin-bottom: 0.35rem !important;
    padding: 0.3rem !important;
    gap: 0.6rem !important;
  }

  .school-logo {
    width: 72px !important;
    height: 80px !important;
  }

  .student-photo {
    width: 78px !important;
    height: 90px !important;
  }

  .ges-header {
    font-size: 0.78rem !important;
    margin-bottom: 0.15rem !important;
  }

  .school-name {
    font-size: 0.95rem !important;
    margin-bottom: 0.15rem !important;
  }

  .school-address,
  .school-contact {
    font-size: 0.7rem !important;
    margin-bottom: 0.15rem !important;
  }

  .report-header h2 {
    font-size: 0.9rem !important;
    margin-top: 0.3rem !important;
  }

  /* Student info optimization */
  .student-info {
    margin-bottom: 0.45rem !important;
    padding: 0.45rem 0.5rem !important;
    font-size: 8.4pt !important;
  }

  .student-info td {
    padding: 0.25rem 0.3rem !important;
    font-size: 8.4pt !important;
  }

  /* Table optimization */
  .score-table {
    margin-bottom: 0.5rem !important;
  }

  .score-table table {
    font-size: 11.2pt !important;
    margin-bottom: 0.22rem !important;
    border: 1px solid #000000 !important;
    border-collapse: collapse !important;
  }

  .score-table th {
    padding: 0.5rem 0.32rem !important;
    font-size: 10.2pt !important;
    border: 1px solid #000000 !important;
  }

  .score-table td {
    padding: 0.46rem 0.32rem !important;
    font-size: 11.2pt !important;
    border: 1px solid #000000 !important;
  }

  .score-table tfoot td {
    padding: 0.56rem 0.32rem !important;
    font-size: 11.2pt !important;
    border: 1px solid #000000 !important;
  }

  /* Remarks optimization */
  .remarks {
    margin-bottom: 0.35rem !important;
    padding: 0.25rem 0 0 !important;
    font-size: 8.9pt !important;
  }

  .remarks table {
    table-layout: fixed !important;
    width: 100% !important;
    margin-bottom: 0.25rem !important;
    border-collapse: collapse !important;
  }

  .remarks td {
    padding: 0.25rem 0.3rem !important;
    font-size: 8.9pt !important;
    vertical-align: top !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
    border: none !important;
    background: transparent !important;
  }

  .remarks td:nth-child(odd) {
    width: 24% !important;
    font-weight: 700 !important;
  }

  .remarks td:nth-child(even) {
    width: 22% !important;
    max-width: 22% !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding-right: 0.1rem !important;
    white-space: nowrap !important;
  }

  .remarks td:nth-child(odd) {
    padding-right: 0.1rem !important;
    white-space: nowrap !important;
  }

  .remarks p {
    margin: 0.15rem 0 0 !important;
    font-size: 8.9pt !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere !important;
  }

  /* Approval section optimization */
  .approval-section {
    margin-bottom: 0.22rem !important;
    padding: 0.34rem 0.46rem !important;
    margin-top: 0.24rem !important;
  }

  .approval-columns {
    gap: 0.7rem !important;
    margin-bottom: 0.18rem !important;
  }

  .approval-label {
    font-size: 7.2pt !important;
    margin-bottom: 0.2rem !important;
  }

  .signature-box {
    padding: 0.2rem !important;
    min-height: 36px !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .signature-name {
    font-size: 0.95rem !important;
    margin-bottom: 0.15rem !important;
    color: #000000 !important;
  }

  .signature-image {
    width: 95px !important;
    height: 70px !important;
    object-fit: contain !important;
    margin-bottom: 0.15rem !important;
  }

  .signature-line {
    min-width: 120px !important;
    margin: 0.24rem auto 0 auto !important;
  }

  /* Hide encouragement message and motto */
  #encouragementMessage,
  #mottoUnderMessage {
    display: none !important;
  }

  /* Reduce spacing between all sections */
  .report-header,
  .student-info,
  .score-table,
  .remarks,
  .approval-section {
    margin-bottom: 0.35rem !important;
  }

  /* Force single page - prevent page breaks */
  .report-container {
    page-break-inside: avoid !important;
    page-break-before: avoid !important;
    page-break-after: avoid !important;
  }

  /* Optimize mock exam table (fewer columns) */
  #scoreTableMock table {
    width: 70% !important;
    margin: 0 auto !important;
  }

  #scoreTableMock th,
  #scoreTableMock td {
    padding: 0.5rem 0.75rem !important;
  }

  /* Ensure all sections fit */
  .report-header,
  .student-info,
  .score-table,
  .remarks,
  .approval-section {
    page-break-inside: avoid !important;
  }

  /* Compact line height for better fit */
  body,
  .report-container,
  .report-container * {
    line-height: 1.05 !important;
  }

  /* Ensure images stay readable */
  .school-logo {
    max-width: 72px !important;
    max-height: 80px !important;
  }

  .student-photo {
    max-width: 78px !important;
    max-height: 90px !important;
  }
}

/* Watermark */
.watermark {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.06;
  width: 70%;
  height: 70%;
  z-index: 0;
  pointer-events: none;
}
.watermark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media print {
  .watermark {
    display: block !important;
    visibility: visible !important;
  }
  .print-page {
    display: block !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
  }
  #bulkPrintContainer {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
  }
}
.ges-header {
  font-size: 1.4em;
  font-weight: bold;
  margin-bottom: 0.2em;
  text-align: center;
}
.school-name {
  font-family: 'Algerian', serif;
  font-size: 1.1em;
  font-weight: bold;
  letter-spacing: 2px;
  text-align: center;
    margin-right: 0.5rem;
    margin-left: 12px;
  font-size: 0.95rem;
  color: #444;
  font-style: normal;
  margin-top: 0.2rem;
  margin-bottom: 0.4rem;
  text-align: center;
}

/* Override global uppercase rule for the address and make it bold */
.school-address {
  text-transform: none !important; /* Display as lowercase */
  font-weight: bold;
  font-size: 0.9em;
  margin: 0.3em 0;
}

/* School contact info (website and email) */
.school-contact {
  text-transform: none !important;
  font-size: 0.85em;
  margin: 0.3em 0;
  line-height: 1.4;
}

.school-contact div {
  text-transform: none !important;
  color: #333;
}

.school-contact a {
  text-transform: none !important;
  color: #0066cc;
  text-decoration: none;
}

.school-contact a:hover {
  text-decoration: underline;
}

/* More specific selector to override the global uppercase rule on the report container */
.report-header .school-address {
  text-transform: none !important;
}

.report-header .school-contact {
  text-transform: none !important;
}

.report-header .school-contact a {
  text-transform: none !important;
}

@media print {
  .report-header .school-address { text-transform: none !important; font-weight: bold !important; }
  .report-header .school-contact { text-transform: none !important; }
  .report-header .school-contact a { text-transform: none !important; }
}
.motto-under-logo {
  font-size: 1em;
  font-style: italic;
  text-align: center;
  margin-top: 0.5em;
}
.header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
}
@media print {
  .report-header .school-address { text-transform: none !important; font-weight: bold !important; }
  .report-header .school-contact { text-transform: none !important; }
  .report-header .school-contact a { text-transform: none !important; }
  .school-logo, .student-photo {
    max-width: 60px;
    max-height: 60px;
  }
  #filters, .report-footer button {
    display: none !important;
  }
  .watermark {
    display: block !important;
  }
}

/* Change all report text to block (uppercase) letters */
.report-container, .report-container * {
  text-transform: uppercase;
}
.motto-under-message {
  display: none !important;
}

/* Approval section styling */
.approval-section {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, #e0e7ff 100%);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.approval-section h3 {
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.signature-line {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.signature-item {
  flex: 1;
  min-width: 200px;
  text-align: center;
}
@media print {
  .report-header .school-address { text-transform: none !important; font-weight: bold !important; }
  .report-header .school-contact { text-transform: none !important; }
  .report-header .school-contact a { text-transform: none !important; }
}

/* Style for filled text fields except result table */
span[id^="studentName"], span[id^="studentClass"], span[id^="term"], span[id^="year"], span[id^="totalInClass"], span[id^="position"], span[id^="totalAttendance"], span[id^="actualAttendance"], span[id^="promotionStatus"], span[id^="studentInterest"], span[id^="studentConduct"], span[id^="teacherRemark"] {
  color: #ff6600;
  font-weight: bold;
  position: relative;
  text-align: center;
  display: block;
  white-space: nowrap;
  min-width: 180px;
}
span[id^="studentName"], span[id^="studentClass"], span[id^="term"], span[id^="year"], span[id^="totalInClass"], span[id^="position"], span[id^="totalAttendance"], span[id^="actualAttendance"], span[id^="promotionStatus"], span[id^="studentInterest"], span[id^="studentConduct"], span[id^="teacherRemark"], span#vacationDate, span#reopenDate {
  display: inline-block;
  min-width: 2.5em;
  border-bottom: 3px double #ff6600;
  margin-top: 2px;
  width: 100%;
  text-align: center;
}
#encouragementMessage {
  text-transform: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--primary);
  padding: 1rem 1.2rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
  color: var(--text-primary);
  margin-top: 1rem;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Ensure the message prints correctly */
@media print {
  #encouragementMessage {
    border: 2px solid rgb(1, 1, 1) !important;
    background: transparent !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Strong final print override to ensure the badge appears at required size
   This overrides earlier conflicting rules (including any display: none). */
/* Use an explicit DOM element for the printed badge to avoid pseudo-element
   inconsistencies across print engines. Hide the old ::before in print. */
.print-badge { display: none; }

@media print {
  /* hide pseudo-element to avoid doubling or conflicting sizing */
  .report-container::before { display: none !important; }

  .print-badge {
    display: block !important;
    position: absolute !important;
    top: 16mm !important;
    left: 16mm !important;
    width: 520px !important;
    height: 520px !important;
    /* use an actual img tag for reliable printing */
    background: none !important;
    opacity: 0.08 !important;
    pointer-events: none !important;
    z-index: 0 !important;
    transform: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .print-badge-img {
    display: block !important;
    width: 140px !important;
    height: 100px !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    opacity: 0.08 !important;
    border: none !important;
  }
  /* Also provide mm-based sizing to avoid DPI scaling differences */
  @page { size: A4 portrait; margin: 9mm; }
  .print-badge, .print-badge-img { width: 140mm !important; height: 140mm !important; }
}
/* Final override: ensure header-left school logo prints at full intended size */
@media print {
  .report-header .school-logo {
    display: block !important;
    width: 140px !important;
    height: 100px !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
    margin-right: 0.7rem !important;
    margin-left: 0.2rem !important;
    box-shadow: none !important;
  }
  /* If some print UIs scale pages, provide an mm fallback sized proportionally */
  .report-header .school-logo { width: 140px !important; height: 100px !important; }
  
  /* Signature image print styling */
  .signature-box {
    width: 240px !important;
    max-width: 95% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0.25rem 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .signature-image {
    width: 100% !important;
    height: 70px !important;
    max-height: 70px !important;
    object-fit: contain !important;
    object-position: center !important;
    margin-bottom: 0.25rem !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* Redesigned Report Dashboard Overview */
.dashboard-overview {
  max-width: 1200px;
  margin: 1.25rem auto 2rem auto;
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, rgba(14,122,81,0.05), rgba(6,78,59,0.03));
  border-radius: 10px;
  border: 1px solid rgba(15,23,42,0.04);
  display: block;
}
.dashboard-overview h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.15rem;
  color: var(--text-primary);
  font-weight: 700;
}
.dashboard-cards {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
}
.dashboard-card {
  flex: 1 1 30%;
  min-width: 200px;
  background: white;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 6px 18px rgba(16,24,40,0.06);
  border: 1px solid rgba(15,23,42,0.03);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.dashboard-card .icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  border-radius: 8px;
  color: white;
}
.dashboard-card .meta {
  display: flex;
  flex-direction: column;
}
.dashboard-card .meta .label {
  font-weight: 700;
  color: var(--text-primary);
}
.dashboard-card .meta .hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(16,24,40,0.12);
}
.dashboard-card[data-section="reportSection"] .icon { background: linear-gradient(135deg,#059669,#048059); }
.dashboard-card[data-section="filters"] .icon { background: linear-gradient(135deg,#06b6d4,#0891b2); }
.dashboard-card[data-section="student-selector"] .icon { background: linear-gradient(135deg,#f59e0b,#d97706); }

@media (max-width: 900px) {
  .dashboard-card { flex: 1 1 48%; }
}
@media (max-width: 520px) {
  .dashboard-card { flex: 1 1 100%; }
  .dashboard-overview { padding: 0.5rem; }
}

/* General reporting workspace: modern screen presentation (print styles remain above). */
@media screen {
  :root {
    --report-ink: #17243d;
    --report-muted: #66758c;
    --report-line: #e2e8f0;
    --report-teal: #197278;
    --report-teal-dark: #145e66;
    --report-surface: #ffffff;
    --report-canvas: #f2f5f9;
    --report-shadow: 0 16px 44px rgba(20, 35, 58, 0.09);
  }

  html { min-height: 100%; background: var(--report-canvas); scroll-behavior: smooth; }

  body {
    min-height: 100vh;
    padding: 24px;
    background:
      radial-gradient(circle at 88% 0%, rgba(25, 114, 120, 0.10), transparent 28rem),
      var(--report-canvas);
    color: var(--report-ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
  }

  .report-container {
    width: min(100%, 1280px);
    max-width: 1280px;
    min-height: 0;
    margin: 0 auto;
    padding: 24px;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    overflow: visible;
    border: 1px solid #e0e6ee;
    border-top: 5px solid var(--report-teal);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--report-shadow);
    backdrop-filter: blur(12px);
    transition: none;
  }

  .report-container:hover {
    transform: none;
    box-shadow: var(--report-shadow);
  }

  .report-container::before { opacity: 0.36; font-size: clamp(2rem, 5vw, 4rem); }
  .report-container * { font-family: inherit; text-transform: none; }
  .report-container .signature-name { font-family: "Dancing Script", "Brush Script MT", cursive !important; }
  .overview-kicker,
  .student-selector .selector-field label,
  .student-info td:nth-child(odd),
  .ges-header,
  .motto-header-dup,
  .approval-label,
  .score-table th { text-transform: uppercase; }

  .fixed-action-buttons {
    position: static;
    display: flex;
    width: 100%;
    max-width: none;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0 0 22px;
    padding: 10px;
    border: 1px solid var(--report-line);
    border-radius: 13px;
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(20, 35, 58, 0.04);
  }

  .fixed-action-buttons .back-btn {
    display: inline-flex;
    width: auto;
    min-width: 0;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #d5dee8;
    border-radius: 9px;
    background: #fff !important;
    color: #41516a !important;
    box-shadow: none;
    font-size: 0.72rem;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
  }

  .fixed-action-buttons .back-btn:hover {
    transform: translateY(-1px);
    border-color: #aab9ca;
    background: #f1f6f8 !important;
    box-shadow: none;
  }

  #backToAdminBtn {
    display: inline-flex !important;
    margin-right: auto;
    border-color: var(--report-teal-dark) !important;
    background: var(--report-teal-dark) !important;
    color: #fff !important;
  }

  #backToAdminBtn:hover { background: #104d53 !important; }

  #printClassRankingBtn,
  #printSubclassRankingsBtn { background: #fff !important; color: #41516a !important; }

  #printIncompleteSubjectsBtn {
    border-color: #f0d8aa !important;
    background: #fff8eb !important;
    color: #8b631e !important;
  }

  .dashboard-overview {
    max-width: none;
    margin: 0 0 18px;
    padding: 27px;
    border: 1px solid var(--report-line);
    border-top: 0;
    border-radius: 16px;
    background: linear-gradient(125deg, #f4f9f9 0%, #ffffff 62%, #f5f7fc 100%);
    box-shadow: 0 8px 22px rgba(20, 35, 58, 0.05);
    text-align: left;
  }

  .overview-heading { margin-bottom: 20px; }

  .overview-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--report-teal);
    font-size: 0.65rem;
    font-weight: 850;
    letter-spacing: 0.16em;
  }

  .dashboard-overview h2 {
    margin: 0;
    color: var(--report-ink);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    text-transform: none;
  }

  .overview-heading p {
    margin: 8px 0 0;
    color: var(--report-muted);
    font-size: 0.88rem;
    line-height: 1.5;
  }

  .dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
    margin: 0;
  }

  .dashboard-card {
    appearance: none;
    min-width: 0;
    min-height: 104px;
    justify-content: flex-start;
    padding: 17px;
    border: 1px solid var(--report-line);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(20, 35, 58, 0.05);
    color: var(--report-ink);
    font-size: 0.85rem;
    font-family: inherit;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
  }

  .dashboard-card:hover,
  .dashboard-card:focus-visible {
    transform: translateY(-2px);
    border-color: #bdd6d7;
    background: #fbfefe;
    box-shadow: 0 12px 24px rgba(20, 35, 58, 0.09);
    outline: none;
  }

  .dashboard-card .icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 12px;
    font-size: 1.15rem;
  }

  .dashboard-card[data-section="reportSection"] .icon { background: linear-gradient(135deg, #247b68, #1d6559); }
  .dashboard-card[data-section="filters"] .icon { background: linear-gradient(135deg, #228c91, #176f78); }
  .dashboard-card[data-section="student-selector"] .icon { background: linear-gradient(135deg, #6674a9, #4e5d90); }
  .dashboard-card .meta { min-width: 0; gap: 4px; }
  .dashboard-card .meta .label { color: var(--report-ink); font-size: 0.86rem; font-weight: 800; }
  .dashboard-card .meta .hint { color: var(--report-muted); font-size: 0.74rem; line-height: 1.4; }

  .student-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
    margin: 0 0 20px;
    padding: 23px;
    border: 1px solid var(--report-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 9px 25px rgba(20, 35, 58, 0.06);
    text-align: left;
  }

  .selector-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8edf2;
  }

  .selector-heading h2 {
    margin: 0;
    color: var(--report-ink);
    font-size: 1.14rem;
    font-weight: 800;
    letter-spacing: -0.03em;
  }

  .selector-heading p { margin: 0; color: var(--report-muted); font-size: 0.78rem; }

  .promotion-pass-mark-field input { border-color: #d5b875 !important; background: #fffaf0 !important; }
  .promotion-pass-mark-field label { color: #806528 !important; }

  .selector-field { display: flex; min-width: 0; flex-direction: column; gap: 6px; }

  .student-selector .selector-field label {
    margin: 0;
    color: #506078;
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .student-selector .selector-field input,
  .student-selector .selector-field select {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    padding: 10px 12px;
    border: 1px solid #d9e1ea;
    border-radius: 9px;
    background: #fff;
    color: var(--report-ink);
    font: inherit;
    font-size: 0.84rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }

  .student-selector .selector-field input:focus,
  .student-selector .selector-field select:focus {
    border-color: var(--report-teal);
    box-shadow: 0 0 0 3px rgba(25, 114, 120, 0.12);
    outline: none;
  }

  .selector-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; padding-top: 2px; }

  #bulkPrintBtn {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--report-teal-dark);
    border-radius: 9px;
    background: var(--report-teal-dark);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 5px 12px rgba(20, 94, 102, 0.14);
    cursor: pointer;
  }

  #bulkPrintBtn:hover { background: #104d53; }

  #reportSection {
    max-width: 1040px;
    margin: 0 auto;
    padding: 25px;
    border: 1px solid var(--report-line);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--report-shadow);
  }

  .report-header {
    gap: 20px;
    margin-bottom: 18px;
    padding: 19px;
    border: 1px solid #e0e7ed;
    border-top: 4px solid var(--report-teal);
    border-radius: 13px;
    background: linear-gradient(135deg, #f7fafb, #ffffff);
    box-shadow: none;
  }

  .school-logo { width: 92px; height: 100px; padding: 5px; border-radius: 12px; }
  .header-right { position: relative; }
  .student-photo { width: 88px; height: 108px; object-fit: cover; border: 2px solid #d9e1e9; border-radius: 11px; }
  #studentPhoto[src=""] { visibility: hidden; }
  .student-photo-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    width: 88px;
    height: 108px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #bdcad7;
    border-radius: 11px;
    background: linear-gradient(145deg, #f7fafc, #edf2f6);
    color: #738196;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1.55;
    text-align: center;
  }
  .header-right:has(#studentPhoto[src=""]) .student-photo-placeholder { display: flex; }
  .header-center { padding: 0 7px; }
  .ges-header { color: var(--report-teal-dark); font-size: 0.78rem; letter-spacing: 0.12em; }
  .school-name { margin-bottom: 5px; color: var(--report-ink); font-size: 1.22rem; letter-spacing: 0.01em; }
  .school-address { margin-bottom: 5px; color: var(--report-muted); font-size: 0.76rem; font-style: normal; }
  .school-contact { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; font-size: 0.72rem; }
  .motto-header-dup { margin-top: 7px; color: #3a7764; font-size: 0.73rem; letter-spacing: 0.12em; }
  .report-header h2 { margin-top: 9px; padding-top: 8px; color: var(--report-ink); font-size: 1.08rem; letter-spacing: 0.08em; }

  .student-info {
    margin-bottom: 17px;
    padding: 12px;
    border: 1px solid var(--report-line);
    border-radius: 12px;
    background: #f8fafc;
    box-shadow: none;
  }

  .student-info table,
  .remarks table { margin-bottom: 0 !important; }

  .student-info td {
    padding: 9px 10px;
    border: 1px solid #e4eaf0;
    font-size: 0.78rem;
  }

  .student-info td:nth-child(odd) { width: auto; color: #516178; font-size: 0.68rem; letter-spacing: 0.03em; text-transform: uppercase; }
  .student-info td:nth-child(even) { color: var(--report-ink); font-weight: 700; }

  #reportSection .student-info td:nth-child(odd) {
    width: 13%;
    background: #f0f4f7;
    color: #5d6c81;
    font-size: 0.65rem;
    line-height: 1.35;
    white-space: nowrap;
  }

  #reportSection .student-info td:nth-child(even) {
    width: 20.33%;
    background: #fff;
    color: var(--report-ink);
  }

  #reportSection .student-info td:nth-child(even) span[id] {
    display: inline-block;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    color: var(--report-ink) !important;
    font-size: 0.77rem;
    font-weight: 750;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .score-table { margin-bottom: 16px; }

  .score-table table {
    border: 1px solid #dbe3eb;
    border-radius: 11px;
    box-shadow: 0 4px 12px rgba(20, 35, 58, 0.04);
    font-size: 0.8rem;
  }

  .score-table th {
    padding: 10px 11px;
    border-color: #1c355e;
    background: #203c66;
    font-size: 0.69rem;
    letter-spacing: 0.04em;
  }

  .score-table .results-details-header {
    background: var(--report-teal-dark) !important;
    font-size: 0.76rem !important;
    letter-spacing: 0.08em;
  }

  .score-table td { padding: 9px 10px; border-color: #e5eaf0; font-size: 0.78rem; }
  .score-table tfoot td { border-top: 2px solid #bdcbd7; background: #f5f8fa; font-size: 0.8rem; }

  .remarks {
    margin-bottom: 16px;
    padding: 13px 15px;
    border: 1px solid var(--report-line);
    border-radius: 12px;
    background: #f8fafc;
  }

  .remarks td { padding: 7px 8px; font-size: 0.77rem; }
  .remarks td:nth-child(odd) { color: #526179; font-size: 0.67rem; }
  .remarks td:nth-child(even) { color: var(--report-ink); }
  .remarks p { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e3e9ef; color: #364760; font-size: 0.82rem; }
  #reportSection .remarks td:nth-child(even) span[id],
  #reportSection .remarks p span[id] {
    display: inline !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    color: var(--report-ink) !important;
    text-align: left;
    white-space: normal;
  }

  .approval-section {
    margin: 0 0 14px;
    padding: 14px;
    border: 1px solid var(--report-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: none;
  }

  .approval-columns { gap: 16px; margin-bottom: 0; padding: 0; }
  .approval-label { border-color: #c5d9da; color: #42536b; font-size: 0.68rem; letter-spacing: 0.06em; }

  .signature-box {
    min-height: 68px;
    padding: 7px;
    border: 1px dashed #d5dee7 !important;
    border-radius: 9px;
    background: #fbfcfd !important;
  }

  .signature-line { width: 85%; border-color: #8391a2; }
  .report-footer { margin-top: 12px; padding: 13px; border: 1px solid var(--report-line); border-radius: 12px; background: #f8fafc; }
  .report-footer button { margin: 4px; padding: 10px 14px; border-radius: 8px; font-size: 0.78rem; }

  .watermark { opacity: 0.035; pointer-events: none; }

  @media (max-width: 900px) {
    body { padding: 14px; }
    .report-container { min-height: 0; padding: 17px; }
    .fixed-action-buttons { justify-content: flex-start; flex-wrap: wrap; }
    .fixed-action-buttons #backToAdminBtn { margin-right: auto; }
    .dashboard-overview { padding: 21px; }
    .dashboard-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .student-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #reportSection { padding: 17px; }
  }

  @media (max-width: 600px) {
    body { padding: 8px; }
    .report-container { min-height: 0; padding: 11px; border-radius: 15px; }
    .fixed-action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 13px; padding: 8px; }
    .fixed-action-buttons .back-btn { width: 100%; min-height: 40px; padding: 8px 6px; font-size: 0.64rem; white-space: normal; }
    #backToAdminBtn { grid-column: 1 / -1; margin: 0 !important; }
    .dashboard-overview { padding: 17px 13px; margin-bottom: 13px; }
    .dashboard-overview h2 { font-size: 1.26rem; }
    .overview-heading p { font-size: 0.78rem; }
    .dashboard-cards { grid-template-columns: 1fr; gap: 8px; }
    .dashboard-card { min-height: 74px; padding: 12px; }
    .dashboard-card .icon { width: 39px; height: 39px; flex-basis: 39px; }
    .dashboard-card .meta .hint { font-size: 0.7rem; }
    .student-selector { grid-template-columns: 1fr; gap: 11px; margin-bottom: 14px; padding: 15px 12px; }
    .selector-heading { align-items: flex-start; flex-direction: column; gap: 6px; padding-bottom: 11px; }
    .selector-heading p { font-size: 0.73rem; }
    .selector-actions { justify-content: stretch; }
    #bulkPrintBtn { width: 100%; }
    #reportSection { padding: 11px 8px; border-radius: 12px; }
    .report-header { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 6px; padding: 10px 7px; border-radius: 10px; }
    .header-left, .header-right { width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; margin: 0; }
    .school-logo { width: 48px !important; height: 55px !important; max-width: 48px !important; max-height: 55px !important; }
    .student-photo { width: 48px !important; height: 58px !important; max-width: 48px !important; max-height: 58px !important; }
    .student-photo-placeholder { width: 48px; height: 58px; font-size: 0.43rem; }
    .header-center { padding: 0; }
    .ges-header { font-size: 0.55rem; letter-spacing: 0.06em; }
    .school-name { font-size: 0.72rem; line-height: 1.25; }
    .school-address { font-size: 0.58rem; line-height: 1.3; }
    .school-contact { flex-direction: column; gap: 2px; font-size: 0.55rem; }
    .motto-header-dup { font-size: 0.56rem; }
    .report-header h2 { margin-top: 5px; padding-top: 5px; font-size: 0.65rem; letter-spacing: 0.03em; }
    .student-info { padding: 6px; overflow-x: auto; }
    .student-info table { min-width: 700px; table-layout: fixed; }
    .student-info td { padding: 5px 4px; font-size: 0.62rem; overflow-wrap: anywhere; }
    .student-info td:nth-child(odd) { font-size: 0.52rem; white-space: normal; }
    .score-table { overflow-x: auto; }
    .score-table table { min-width: 520px; font-size: 0.67rem; }
    .score-table th, .score-table td { padding: 6px 5px; font-size: 0.64rem; }
    .remarks { padding: 8px 7px; overflow-x: auto; }
    .remarks table { min-width: 460px; }
    .approval-columns { gap: 6px; }
    .approval-label { font-size: 0.55rem; }
    .approval-col .signature-box { width: 100%; max-width: 100%; }
    .signature-name { font-size: 1.1rem !important; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  }
}

@media print {
  .student-photo-placeholder { display: none !important; }
}

/* Promotion status colors must win over legacy report-field styling on screen and paper. */
.report-container #promotionStatus.status-promoted {
  color: #15803d !important;
  font-weight: 800 !important;
}

.report-container #promotionStatus.status-repeated {
  color: #b91c1c !important;
  font-weight: 800 !important;
}

.report-container #promotionStatus.status-undetermined {
  color: #666 !important;
}

@media print {
  .report-container #promotionStatus.status-promoted,
  .report-container #promotionStatus.status-repeated,
  .report-container #promotionStatus.status-undetermined {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Keep the printed result sheet visually aligned with its screen preview. */
@media print {
  @page { size: A4 portrait; margin: 8mm; }

  html,
  body {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #17243d !important;
    font-family: "Segoe UI", Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.3 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .report-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 6mm !important;
    overflow: visible !important;
    border: 1px solid #d6dfe8 !important;
    border-top: 4px solid #197278 !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: none !important;
    font-family: "Segoe UI", Arial, sans-serif !important;
    font-size: 10pt !important;
    line-height: 1.3 !important;
    transform: none !important;
    page-break-inside: auto !important;
    page-break-after: auto !important;
  }

  .report-container::before { display: none !important; }
  .report-container * { font-family: inherit; text-transform: none; line-height: inherit !important; }
  .report-container .signature-name { font-family: "Dancing Script", "Brush Script MT", cursive !important; }
  .no-print,
  .fixed-action-buttons,
  #dashboardOverview,
  .student-selector,
  .report-footer,
  .watermark { display: none !important; }

  #reportSection {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .report-header {
    display: flex !important;
    min-height: 31mm;
    align-items: center !important;
    gap: 5mm !important;
    margin: 0 0 4mm !important;
    padding: 3mm !important;
    border: 1px solid #e0e7ed !important;
    border-top: 3px solid #197278 !important;
    border-radius: 7px !important;
    background: #f7fafb !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .header-left,
  .header-right {
    display: flex !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  .school-logo {
    display: block !important;
    width: 22mm !important;
    height: 24mm !important;
    max-width: 22mm !important;
    max-height: 24mm !important;
    margin: 0 !important;
    padding: 1mm !important;
    border: 0 !important;
    border-radius: 5px !important;
    background: #fff !important;
    object-fit: contain !important;
    box-shadow: none !important;
  }

  .header-center {
    min-width: 0;
    flex: 1 1 auto !important;
    padding: 0 1mm !important;
    text-align: center !important;
  }
  #studentPhoto:not([src=""]) ~ .student-photo-placeholder { display: none !important; }

  .student-photo {
    display: block !important;
    width: 21mm !important;
    height: 27mm !important;
    max-width: 21mm !important;
    max-height: 27mm !important;
    border: 1px solid #d9e1e9 !important;
    border-radius: 5px !important;
    background: #f7fafc !important;
    object-fit: cover !important;
    box-shadow: none !important;
  }

  .header-right { position: relative !important; }
  #studentPhoto[src=""] { visibility: hidden !important; }
  .student-photo-placeholder {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    width: 21mm !important;
    height: 27mm !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px dashed #bdcad7 !important;
    border-radius: 5px !important;
    background: #f4f7f9 !important;
    color: #738196 !important;
    font-size: 6pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
    line-height: 1.4 !important;
    text-align: center !important;
  }

  .ges-header {
    margin-bottom: 1mm !important;
    padding-bottom: 1mm !important;
    border-color: #197278 !important;
    color: #145e66 !important;
    font-size: 9pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.1em !important;
  }

  .school-name {
    margin: 1mm 0 !important;
    color: #17243d !important;
    font-family: "Segoe UI", Arial, sans-serif !important;
    font-size: 13pt !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    line-height: 1.15 !important;
  }

  .school-address,
  .school-contact,
  .school-contact div,
  .school-contact a {
    margin: 0.5mm 0 !important;
    color: #66758c !important;
    font-size: 8pt !important;
    font-style: normal !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
  }

  .school-contact { display: flex !important; justify-content: center !important; gap: 1mm 4mm !important; }
  .motto-header-dup { margin-top: 1mm !important; color: #3a7764 !important; font-size: 8pt !important; letter-spacing: 0.1em !important; }

  .report-header h2 {
    margin: 1.5mm 0 0 !important;
    padding: 1mm 0 0 !important;
    border-top: 1px solid #c6d8da !important;
    color: #17243d !important;
    font-size: 10pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
  }

  .student-info {
    margin: 0 0 3mm !important;
    padding: 2mm !important;
    overflow: visible !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .student-info table {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;
  }

  .student-info td {
    padding: 1.8mm 1.7mm !important;
    border: 1px solid #e4eaf0 !important;
    font-size: 9pt !important;
    line-height: 1.25 !important;
    vertical-align: middle !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  #reportSection .student-info td:nth-child(odd) {
    width: 13% !important;
    background: #f0f4f7 !important;
    color: #5d6c81 !important;
    font-size: 7.5pt !important;
    font-weight: 750 !important;
    text-transform: uppercase !important;
  }

  #reportSection .student-info td:nth-child(even) {
    width: 20.33% !important;
    background: #fff !important;
    color: #17243d !important;
    font-weight: 700 !important;
  }

  #reportSection .student-info td:nth-child(even) span[id] {
    display: inline !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    color: #17243d !important;
    font-size: 9pt !important;
    font-weight: 700 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .score-table {
    margin: 0 0 3mm !important;
    overflow: visible !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
  }

  .score-table table {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 1px solid #dbe3eb !important;
    border-collapse: collapse !important;
    border-radius: 5px !important;
    background: #fff !important;
    box-shadow: none !important;
    font-size: 9.5pt !important;
    line-height: 1.25 !important;
  }

  .score-table th {
    padding: 2.2mm 1.5mm !important;
    border: 1px solid #1c355e !important;
    background: #203c66 !important;
    color: #fff !important;
    font-size: 8.25pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.03em !important;
    text-align: center !important;
    vertical-align: middle !important;
  }

  .score-table thead { display: table-header-group !important; }
  .score-table tfoot { display: table-footer-group !important; }
  .score-table tbody tr { break-inside: avoid !important; page-break-inside: avoid !important; }

  .score-table .results-details-header {
    background: #145e66 !important;
    color: #fff !important;
    font-size: 8.75pt !important;
    letter-spacing: 0.08em !important;
  }

  .score-table td {
    padding: 2mm 1.5mm !important;
    border: 1px solid #e1e7ee !important;
    background: #fff !important;
    color: #26374e !important;
    font-size: 9.5pt !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    text-align: center !important;
  }

  .score-table tbody tr:nth-child(even) td { background: #f7f9fb !important; }
  .score-table tfoot td { border-top: 2px solid #bdcbd7 !important; background: #f0f4f7 !important; color: #17243d !important; font-size: 9.5pt !important; font-weight: 800 !important; }

  .remarks {
    margin: 0 0 3mm !important;
    padding: 2.5mm 3mm !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .remarks table { width: 100% !important; margin: 0 !important; border-collapse: collapse !important; table-layout: auto !important; }
  .remarks td { padding: 1.7mm 1.5mm !important; border: 0 !important; background: transparent !important; color: #17243d !important; font-size: 9pt !important; line-height: 1.25 !important; white-space: normal !important; }
  .remarks td:nth-child(odd) { width: auto !important; color: #526179 !important; font-size: 8pt !important; font-weight: 750 !important; white-space: nowrap !important; }
  .remarks td:nth-child(even) { width: auto !important; max-width: none !important; border-bottom: 1px solid #dbe3eb !important; color: #17243d !important; white-space: normal !important; }
  #reportSection .remarks td:nth-child(even) span[id],
  #reportSection .remarks p span[id] { display: inline !important; width: auto !important; min-width: 0 !important; margin: 0 !important; border: 0 !important; color: #17243d !important; font-size: inherit !important; text-align: left !important; white-space: normal !important; }
  .remarks p { margin: 2mm 0 0 !important; padding-top: 2mm !important; border-top: 1px solid #e3e9ef !important; color: #364760 !important; font-size: 9pt !important; line-height: 1.3 !important; }

  .approval-section {
    margin: 0 !important;
    padding: 2mm 3mm !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    background: #fff !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
  }

  .approval-columns { gap: 5mm !important; margin: 0 !important; padding: 0 !important; }
  .approval-label { margin-bottom: 1.5mm !important; padding-bottom: 1mm !important; border-bottom: 1px solid #c5d9da !important; color: #42536b !important; font-size: 8pt !important; font-weight: 800 !important; letter-spacing: 0.06em !important; }
  .signature-box { width: 48mm !important; max-width: 48mm !important; min-height: 17mm !important; height: auto !important; margin: 0 auto !important; padding: 1mm !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  .signature-name { margin: 0 0 1mm !important; color: #17243d !important; font-size: 12pt !important; line-height: 1.1 !important; }
  .signature-image { width: 29mm !important; height: 15mm !important; max-width: 29mm !important; max-height: 15mm !important; margin: 0 auto 1mm !important; object-fit: contain !important; border: 0 !important; box-shadow: none !important; }
  .signature-line { width: 44mm !important; min-width: 0 !important; max-width: 44mm !important; margin: 1mm auto 0 !important; border-bottom: 1px solid #8391a2 !important; }

  .report-container [id^="studentName"],
  .report-container [id^="studentClass"],
  .report-container [id^="term"],
  .report-container [id^="year"],
  .report-container [id^="totalInClass"],
  .report-container [id^="position"],
  .report-container [id^="totalAttendance"],
  .report-container [id^="actualAttendance"],
  .report-container [id^="promotionStatus"],
  .report-container [id^="studentInterest"],
  .report-container [id^="studentConduct"],
  .report-container [id^="teacherRemark"],
  .report-container #vacationDate,
  .report-container #reopenDate {
    display: inline !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    color: #17243d !important;
    font-size: 9pt !important;
    font-weight: 700 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .print-badge { display: none !important; }
  .watermark { display: none !important; }

  .report-header,
  .student-info,
  .remarks,
  .approval-section { break-inside: avoid !important; page-break-inside: avoid !important; }
}

/* Final override: keep Promotion Status readable in both screen and print output. */
.report-container #promotionStatus.status-promoted {
  color: #15803d !important;
  font-weight: 800 !important;
}

.report-container #promotionStatus.status-repeated {
  color: #b91c1c !important;
  font-weight: 800 !important;
}

.report-container #promotionStatus.status-undetermined {
  color: #666 !important;
}

@media print {
  .report-container #promotionStatus.status-promoted,
  .report-container #promotionStatus.status-repeated,
  .report-container #promotionStatus.status-undetermined {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}