.testim-page {
  min-height: 100dvh;
  background: #f4f7fc;
  color: #172b4c;
}

.testim-brand {
  background: #fff;
  border-bottom: 1px solid #dbe5f3;
}

.testim-letterhead {
  width: min(100% - 32px, 900px);
  margin: 0 auto;
  padding: 12px 0;
  gap: clamp(12px, 3vw, 26px);
  border: 0;
  background: transparent;
}

.testim-letterhead img {
  width: clamp(52px, 10vw, 92px);
  height: auto;
}

.testim-letterhead h2 {
  font-size: clamp(17px, 2.5vw, 24px);
  line-height: 1.16;
}

.testim-letterhead h2 strong {
  white-space: nowrap;
}

.testim-letterhead .report-letterhead-details {
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  color: #526482;
  font-size: 12px;
  line-height: 1.4;
}

.testim-main {
  width: min(100% - 32px, 900px);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) 0 44px;
}

.testim-card,
.testim-exam-heading,
.testim-profile {
  padding: clamp(20px, 5vw, 36px);
  background: #fff;
  border: 1px solid #dbe5f3;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgb(23 43 76 / 7%);
}

.testim-card {
  max-width: 460px;
  margin: 0 auto;
}

.testim-exam {
  display: grid;
  gap: 12px;
}

.testim-exam-heading {
  padding: clamp(16px, 3vw, 24px);
}

.testim-page h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 32px);
  overflow-wrap: anywhere;
}

.testim-card > p {
  margin: 10px 0 24px;
  color: #526482;
  line-height: 1.5;
}

.testim-page .stack-form input {
  min-width: 0;
  min-height: 46px;
  font-size: 16px;
}

.testim-error {
  margin: 0;
  color: #a22530;
  font-weight: 600;
}

.testim-error:empty {
  display: none;
}

.testim-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 20px;
  margin: 0;
}

.testim-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: clamp(14px, 3vw, 20px);
}

.testim-avatar {
  display: grid;
  place-items: center;
  width: 104px;
  aspect-ratio: 104 / 132;
  padding: 4px;
  border: 1px solid #d4e1f8;
  border-radius: 12px;
  background: #f4f7fc;
  box-shadow: 0 3px 8px rgb(23 43 76 / 8%);
  color: #173f94;
  font-size: 22px;
  font-weight: 700;
}

.testim-avatar img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.testim-avatar:has(img:not(.hidden)) > span {
  display: none;
}

.testim-schedule {
  grid-column: span 2;
}

.testim-details dt {
  color: #526482;
  font-size: 13px;
}

.testim-details dd {
  margin: 2px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.testim-clock {
  position: sticky;
  z-index: 2;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 9px 16px;
  border: 1px solid #d4e1f8;
  border-radius: 12px;
  background: #eaf1ff;
  color: #173f94;
  font-weight: 650;
}

.testim-clock[data-state="urgent"] {
  background: #fff3db;
  border-color: #f2cf85;
  color: #714000;
}

.testim-clock[data-state="expired"] {
  background: #fce9ec;
  border-color: #edc0c8;
  color: #8e2134;
}

#testim-countdown {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.testim-clock-status {
  flex-basis: 100%;
  font-size: 13px;
}

.testim-clock-status:empty {
  display: none;
}

.testim-page .student-test-body {
  display: grid;
  gap: 14px;
}

.testim-exam-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.testim-exam-actions .testim-error {
  flex-basis: 100%;
  text-align: right;
}

@media (max-width: 560px) {
  .testim-letterhead {
    align-items: flex-start;
  }

  .testim-letterhead h2 strong {
    display: block;
  }

  .testim-letterhead .report-letterhead-details {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    font-size: 11px;
  }

  .testim-profile {
    align-items: start;
    gap: 12px;
  }

  .testim-avatar {
    width: clamp(64px, 19vw, 84px);
  }

  .testim-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  .testim-schedule {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1100px) {
  .testim-main {
    width: min(100% - 32px, 1380px);
  }

  .testim-exam {
    --sidebar-width: clamp(170px, 16vw, 220px);
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
    grid-template-areas:
      "profile title clock"
      "profile questions clock";
    gap: 14px 20px;
  }

  .testim-exam-heading {
    grid-area: title;
  }

  .testim-exam > form {
    grid-area: questions;
    min-width: 0;
  }

  .testim-profile,
  .testim-clock {
    position: sticky;
    top: 16px;
    align-self: start;
  }

  .testim-profile {
    grid-area: profile;
    grid-template-columns: minmax(0, 1fr);
    max-height: calc(100dvh - 32px);
    overflow: auto;
  }

  .testim-profile .testim-avatar {
    justify-self: center;
  }

  .testim-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .testim-schedule {
    grid-column: auto;
  }

  .testim-clock {
    grid-area: clock;
    display: grid;
    justify-content: stretch;
    padding: 16px;
    text-align: center;
  }

  #testim-countdown {
    font-size: clamp(24px, 2.3vw, 32px);
  }
}
