:root {
  --tylos-navy: #142d62;
  --tylos-blue: #285e9d;
  --tylos-teal: #1d7a71;
  --tylos-purple: #6841d8;
  --tylos-border: #d7e0ec;
  --tylos-page: #f4f7fc;
  --tylos-muted: #63728a;
}

.tylos-results-page {
  background: var(--tylos-page);
  min-height: calc(100vh - 50px);
}

.tylos-results-content {
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px;
}

.tylos-results-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 26px 30px;
  color: #fff;
  background: var(--tylos-navy);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(20, 45, 98, 0.16);
}

.tylos-results-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #dbe8ff;
}

.tylos-results-hero h1 {
  margin: 0 0 7px;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.1;
  font-weight: 800;
}

.tylos-results-hero p {
  margin: 0;
  max-width: 760px;
  color: #e4ebf9;
  font-size: 14px;
}

.tylos-results-count {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
}

.tylos-results-count strong {
  font-size: 27px;
  line-height: 1;
}

.tylos-results-count span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tylos-results-list {
  display: grid;
  gap: 22px;
}

.tylos-result-card {
  overflow: hidden;
  border: 1px solid var(--tylos-border);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(20, 45, 98, .08);
}

.tylos-result-toolbar {
  display: flex;
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  z-index: auto !important;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--tylos-border);
  background: #fff;
}

.tylos-result-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.tylos-result-type {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: var(--tylos-navy);
  background: #e8effa;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.tylos-result-identity h2 {
  overflow: hidden;
  margin: 0 0 5px;
  color: #172a50;
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tylos-result-identity p {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0;
  color: var(--tylos-muted);
  font-size: 12px;
}

.tylos-result-status {
  color: #0b7f5b;
  font-weight: 700;
}

.tylos-result-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tylos-result-btn {
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  box-shadow: none;
}

.tylos-result-btn:hover,
.tylos-result-btn:focus {
  color: #fff;
  filter: brightness(.93);
}

.tylos-result-btn-primary {
  color: #fff !important;
  background: var(--tylos-blue);
}

.tylos-result-btn-secondary {
  color: #fff !important;
  background: var(--tylos-teal);
}

.tylos-result-btn-light {
  color: var(--tylos-navy);
  border-color: #bccae0;
  background: #fff;
}

.tylos-result-btn-light:hover,
.tylos-result-btn-light:focus {
  color: var(--tylos-navy);
  background: #edf3fb;
  filter: none;
}

.tylos-result-preview {
  overflow-x: auto;
  padding: 18px;
  background: #e8edf5;
  scrollbar-color: #8da0ba #d9e1ec;
  scrollbar-width: thin;
}

.tylos-result-paper {
  width: 100%;
  min-width: 1020px;
  max-width: 1380px;
  min-height: 650px;
  margin: 0 auto;
  padding: 24px 26px;
  color: #222;
  background: #fff;
  box-shadow: 0 4px 18px rgba(15, 35, 72, .14);
  font-family: Arial, sans-serif;
  font-size: 11px;
}

.tylos-result-paper .tylos-sheet {
  width: 100%;
  min-height: 100%;
}

.tylos-sheet-mobile {
  display: none;
}

.tylos-result-paper .tylos-sheet + .tylos-sheet {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 6px solid #e7edf5;
}

.tylos-result-paper .tylos-pdf-masthead img {
  object-fit: contain;
}

.tylos-result-paper .student-info,
.tylos-result-paper .marks,
.tylos-result-paper .legend,
.tylos-result-paper .signatures {
  width: 100%;
  border-collapse: collapse;
}

.tylos-result-paper .student-info {
  margin: 7px 0;
}

.tylos-result-paper .student-info td {
  padding: 4px 6px;
  border-bottom: 1px solid #cdd3db;
}

.tylos-result-paper .student-info .label {
  color: #2d6bb3;
  font-weight: 700;
}

.tylos-result-paper .marks {
  margin-top: 4px;
}

.tylos-result-paper .marks th {
  padding: 7px 6px;
  color: #fff;
  background: var(--tylos-blue);
  border: 2px solid #fff;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.tylos-result-paper .marks th.group {
  background: #123c70;
}

.tylos-result-paper .marks th.skills-heading {
  width: 96px;
  background: var(--tylos-teal);
  font-size: 8px;
  white-space: nowrap;
}

.tylos-result-paper .marks th.skill-code {
  width: 30px;
  background: #246b65;
}

.tylos-result-paper .marks td {
  padding: 5px 7px;
  border: 2px solid #fff;
  outline: 1px solid #c8d1dc;
  text-align: center;
}

.tylos-result-paper .marks tbody tr:nth-child(even) td {
  background: #f1f6fc;
}

.tylos-result-paper .marks th.assessment-ongoing {
  color: #fff;
  background: #285e9d;
}

.tylos-result-paper .marks th.assessment-summative {
  color: #fff;
  background: #1d7a71;
}

.tylos-result-paper .marks th.result-total {
  color: #fff;
  background: #a86600;
}

.tylos-result-paper .marks tbody tr td.assessment-ongoing {
  color: #183d69;
  background-color: #eef6ff;
}

.tylos-result-paper .marks tbody tr td.assessment-summative {
  color: #175a4a;
  background-color: #eaf8f3;
}

.tylos-result-paper .marks tbody tr td.result-total {
  color: #6e4c00;
  background-color: #fff5dd;
  font-weight: 700;
}

.tylos-result-paper .marks tbody tr td.skill-value {
  color: #174f48;
  background-color: #eff8f5;
  font-weight: 700;
}

.tylos-result-paper .marks td.subject {
  text-align: left;
  font-weight: 700;
}

.tylos-result-paper .marks tbody tr.remark-row:nth-child(odd) td.subject,
.tylos-result-paper .marks tbody tr.remark-row:nth-child(odd) td.subject-remark {
  color: #222;
  background-color: #fff;
}

.tylos-result-paper .marks tbody tr.remark-row:nth-child(even) td.subject,
.tylos-result-paper .marks tbody tr.remark-row:nth-child(even) td.subject-remark {
  color: #222;
  background-color: #f1f6fc;
}

.tylos-result-paper .marks .total-row td {
  color: #164e8c;
  background: #e5f0fd;
  font-weight: 700;
}

.tylos-result-paper .legend {
  margin-top: 9px;
}

.tylos-result-paper .legend th,
.tylos-result-paper .legend td {
  padding: 4px 5px;
  border: 1px solid #9ea9b7;
  text-align: center;
  font-size: 9px;
}

.tylos-result-paper .legend th {
  background: #eef3f9;
}

.tylos-result-paper .remarks-box {
  min-height: 46px;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid #9ea9b7;
}

.tylos-result-paper .general-remarks {
  min-height: 50px;
  border-left: 4px solid #245fa8;
  background: #fbfdff;
}

.tylos-result-paper .remarks-box strong {
  display: block;
  margin-bottom: 4px;
  color: #245fa8;
}

.tylos-result-paper .remark-copy {
  padding-top: 4px;
}

.tylos-result-paper .signatures {
  margin-top: 9px;
}

.tylos-result-paper .signatures td {
  width: 33.33%;
  height: 50px;
  padding-top: 4px;
  border-top: 1px solid #717985;
  text-align: center;
  vertical-align: bottom;
}

.tylos-result-paper .signatures .tylos-teacher-signature-slot {
  height: 30px !important;
}

.tylos-result-paper .signatures td > span:last-child {
  display: block;
  padding-top: 3px;
}

.tylos-result-paper .school-footer {
  display: none;
}

.tylos-results-empty {
  padding: 70px 24px;
  border: 1px solid var(--tylos-border);
  border-radius: 15px;
  background: #fff;
  text-align: center;
  box-shadow: 0 10px 26px rgba(20, 45, 98, .06);
}

.tylos-results-empty-icon {
  display: inline-flex;
  width: 64px;
  height: 64px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--tylos-blue);
  background: #e9f1fb;
  border-radius: 50%;
  font-size: 25px;
}

.tylos-results-empty h2 {
  margin: 0 0 8px;
  color: var(--tylos-navy);
  font-size: 22px;
  font-weight: 800;
}

.tylos-results-empty p {
  margin: 0;
  color: var(--tylos-muted);
}

.tylos-public-exam-page {
  width: 100%;
  margin: -72px auto 64px;
}

.tylos-public-search-card {
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--tylos-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(20, 45, 98, .1);
}

.tylos-public-search-heading {
  padding: 25px 28px 23px;
  color: #fff;
  background: linear-gradient(120deg, var(--tylos-navy), var(--tylos-blue));
}

.tylos-public-search-heading h1 {
  margin: 0 0 7px;
  color: #fff;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
}

.tylos-public-search-heading p {
  margin: 0;
  color: #e4ebf9;
  font-size: 14px;
}

.tylos-public-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.45fr) auto;
  gap: 18px;
  align-items: start;
  padding: 24px 28px 27px;
}

.tylos-public-field label {
  display: block;
  margin-bottom: 7px;
  color: #1b315b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.tylos-public-field .form-control {
  width: 100%;
  height: 44px;
  border-color: #becbde;
  border-radius: 8px;
  background: #fff;
  color: #172a50;
  box-shadow: none;
}

.tylos-public-field .form-control:focus {
  border-color: var(--tylos-blue);
  box-shadow: 0 0 0 3px rgba(40, 94, 157, .12);
}

.tylos-public-search-action {
  padding-top: 24px;
}

.tylos-public-search-button {
  min-width: 120px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--tylos-blue);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(40, 94, 157, .23);
}

.tylos-public-search-button:hover,
.tylos-public-search-button:focus {
  color: #fff;
  background: #204f87;
}

.tylos-public-result-alert {
  margin: 0 0 22px;
  padding: 14px 17px;
  border: 1px solid #efb7bd;
  border-radius: 10px;
  color: #8b2635;
  background: #fff2f3;
  font-weight: 700;
}

.tylos-public-result-output {
  min-height: 0;
  background: transparent;
}

.tylos-public-result-output .tylos-results-content {
  padding: 0;
}

@media (max-width: 900px) {
  .tylos-results-content {
    padding: 16px;
  }

  .tylos-results-hero,
  .tylos-result-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tylos-results-count {
    align-self: stretch;
    justify-content: center;
  }

  .tylos-result-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tylos-result-preview {
    padding: 12px;
  }

  .tylos-public-search-form {
    grid-template-columns: 1fr 1fr;
  }

  .tylos-public-search-action {
    grid-column: 1 / -1;
    padding-top: 0;
  }
}

@media (max-width: 700px) {
  .tylos-public-result-output .tylos-results-hero {
    display: none;
  }

  .tylos-result-preview {
    overflow: visible;
    padding: 10px;
  }

  .tylos-result-paper {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
  }

  .tylos-sheet-desktop {
    display: none;
  }

  .tylos-sheet-mobile {
    display: block;
    overflow: hidden;
    border: 1px solid #d5deeb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 15px rgba(15, 35, 72, .08);
  }

  .tylos-mobile-brand {
    display: flex;
    align-items: center;
    flex-direction: column;
    padding: 18px 16px 16px;
    color: #fff;
    background: linear-gradient(145deg, #fff 0, #fff 48%, #f5f8fc 100%);
    text-align: center;
  }

  .tylos-mobile-brand img {
    display: block;
    width: auto;
    max-width: 230px;
    height: auto;
    max-height: 84px;
    margin-bottom: 10px;
    object-fit: contain;
  }

  .tylos-mobile-brand strong {
    color: var(--tylos-navy);
    font-size: 17px;
    line-height: 1.25;
  }

  .tylos-mobile-brand > span {
    display: block;
    align-self: stretch;
    margin: 13px -16px 0;
    padding: 10px 12px;
    color: #fff;
    background: #a30020;
    border-bottom: 4px solid var(--tylos-navy);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .tylos-mobile-brand small {
    display: block;
    margin-top: 8px;
    color: #64738a;
    font-size: 10px;
    line-height: 1.35;
  }

  .tylos-mobile-student-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    border-top: 1px solid #d5deeb;
    border-bottom: 1px solid #d5deeb;
    background: #d5deeb;
  }

  .tylos-mobile-student-grid > div {
    min-width: 0;
    padding: 11px 12px;
    background: #f8fafd;
  }

  .tylos-mobile-student-grid .tylos-mobile-wide {
    grid-column: 1 / -1;
  }

  .tylos-mobile-student-grid span,
  .tylos-mobile-score-grid span,
  .tylos-mobile-remark > span {
    display: block;
    margin-bottom: 4px;
    color: #61718a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .tylos-mobile-student-grid strong {
    display: block;
    overflow-wrap: anywhere;
    color: #172a50;
    font-size: 12px;
    line-height: 1.35;
  }

  .tylos-mobile-subjects {
    padding: 14px 12px 4px;
  }

  .tylos-mobile-subjects h3 {
    margin: 0 0 10px;
    color: var(--tylos-navy);
    font-size: 15px;
    font-weight: 800;
  }

  .tylos-mobile-subject-card {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid #d8e1ed;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(20, 45, 98, .05);
  }

  .tylos-mobile-subject-card h4 {
    margin: 0 0 10px;
    color: #162b54;
    font-size: 14px;
    font-weight: 800;
  }

  .tylos-mobile-score-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .tylos-mobile-score-grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tylos-mobile-score-grid > div {
    padding: 8px 6px;
    border-radius: 7px;
    background: #eef4fb;
    text-align: center;
  }

  .tylos-mobile-score-grid strong {
    color: #173b6f;
    font-size: 15px;
  }

  .tylos-mobile-remark {
    margin-top: 8px;
    padding: 9px 10px;
    border-left: 3px solid #d69a1c;
    border-radius: 5px;
    color: #4d3a0e;
    background: #fff8e7;
    line-height: 1.4;
  }

  .tylos-mobile-remark strong {
    color: #4d3a0e;
  }

  .tylos-mobile-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
  }

  .tylos-mobile-skills span {
    padding: 5px 8px;
    border-radius: 999px;
    color: #176157;
    background: #e9f7f3;
    font-size: 10px;
    font-weight: 800;
  }

  .tylos-mobile-general-remarks {
    margin: 6px 12px 14px;
    padding: 12px;
    border-left: 4px solid var(--tylos-blue);
    border-radius: 6px;
    background: #f5f9fe;
  }

  .tylos-mobile-general-remarks strong {
    display: block;
    margin-bottom: 6px;
    color: #245fa8;
  }

  .tylos-mobile-general-remarks p {
    margin: 0;
    color: #31425c;
    font-size: 12px;
    line-height: 1.5;
  }
}

@media (max-width: 560px) {
  .tylos-results-content {
    padding: 10px;
  }

  .tylos-results-hero {
    padding: 20px;
    border-radius: 12px;
  }

  .tylos-result-identity {
    align-items: flex-start;
    flex-direction: column;
  }

  .tylos-result-identity h2 {
    white-space: normal;
  }

  .tylos-result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tylos-result-actions .tylos-result-btn:last-child {
    grid-column: auto;
  }

  .tylos-public-exam-page {
    margin: 12px auto 40px;
  }

  .tylos-public-search-heading,
  .tylos-public-search-form {
    padding: 20px;
  }

  .tylos-public-search-form {
    grid-template-columns: 1fr;
  }

  .tylos-public-search-action {
    grid-column: auto;
  }

  .tylos-public-search-button {
    width: 100%;
  }
}

@media print {
  html,
  body {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.tylos-result-printing {
    overflow: visible !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.tylos-result-printing .main-header,
  body.tylos-result-printing .main-sidebar,
  body.tylos-result-printing .control-sidebar,
  body.tylos-result-printing .main-footer,
  body.tylos-result-printing .tylos-results-hero,
  body.tylos-result-printing .tylos-result-toolbar,
  body.tylos-result-printing .tylos-result-card:not(.tylos-result-print-target) {
    display: none;
  }

  body.tylos-result-printing .wrapper,
  body.tylos-result-printing .content-wrapper,
  body.tylos-result-printing .tylos-results-page,
  body.tylos-result-printing .tylos-results-content,
  body.tylos-result-printing .tylos-results-list {
    display: block !important;
    position: static !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.tylos-result-printing .content-wrapper {
    margin-left: 0 !important;
  }

  body.tylos-result-printing .tylos-result-print-target {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  body.tylos-result-printing .tylos-result-preview {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }

  body.tylos-result-printing .tylos-result-paper {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  body.tylos-result-printing .tylos-result-paper .tylos-sheet {
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  /* A full 14-subject report card must remain on one A4 landscape page. */
  body.tylos-result-printing.tylos-print-landscape .tylos-result-paper {
    font-size: 9px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .tylos-pdf-letterhead {
    margin-bottom: 3px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .tylos-pdf-masthead td {
    height: 66px !important;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .tylos-pdf-masthead img {
    max-height: 62px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .student-info {
    margin: 3px 0 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .student-info td {
    padding: 2px 4px !important;
    font-size: 8px !important;
    line-height: 1.1 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .marks {
    margin-top: 2px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .marks th {
    padding: 3px 4px !important;
    border-width: 1px !important;
    font-size: 8px !important;
    line-height: 1.05 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .marks td {
    padding: 2px 4px !important;
    border-width: 1px !important;
    font-size: 8.5px !important;
    line-height: 1.05 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .legend {
    margin-top: 4px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .legend th,
  body.tylos-result-printing.tylos-print-landscape .legend td {
    padding: 2px 3px !important;
    font-size: 7px !important;
    line-height: 1.05 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .remarks-box {
    min-height: 28px !important;
    margin-top: 3px !important;
    padding: 4px 6px !important;
    font-size: 8px !important;
    line-height: 1.1 !important;
  }

  body.tylos-result-printing.tylos-print-landscape .general-remarks {
    min-height: 30px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .signatures {
    margin-top: 4px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .signatures td {
    height: 28px !important;
    padding-top: 1px !important;
    font-size: 8px !important;
  }

  body.tylos-result-printing.tylos-print-landscape .signatures .tylos-teacher-signature-slot {
    height: 15px !important;
  }
}
