/* Testify UI layer: one focused action per surface, strong readable contrast,
   consistent spacing, visible state and comfortable keyboard/touch targets. */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c2940;
  --muted: #59687b;
  --line: #dae3ee;
  --primary: #2458cb;
  --primary2: #1949b5;
  --soft: #edf3ff;
  --brand-ink: #1c2940;
  --shadow: 0 8px 28px rgba(24, 44, 79, .055);
  --focus-ring: 0 0 0 3px rgba(36, 88, 203, .24);
}

html { scroll-behavior: smooth; }
body { background: var(--bg); line-height: 1.5; }
h1, h2, h3 { text-wrap: balance; }
p { color: var(--muted); }
.shell { max-width: 1240px; padding-top: 40px; }
.card { background: var(--card); border-color: var(--line); box-shadow: var(--shadow); }
.topbar { background: #fff; box-shadow: none; border-color: var(--line); }
.brandMark { background: var(--primary); box-shadow: none; }
.brandMark::before { display: none; }
.brandTick { box-shadow: none; }
.eyebrow { color: var(--primary); letter-spacing: .085em; }
.pageHead h1 { font-size: clamp(2rem, 2.6vw, 2.75rem); letter-spacing: -.04em; }
.pageHead p { font-size: 15px; line-height: 1.55; }

.skipLink {
  position: fixed; z-index: 1000; top: 8px; left: 12px; transform: translateY(-150%);
  padding: 10px 14px; border-radius: 9px; background: #fff; color: var(--primary);
  font-weight: 750; box-shadow: var(--shadow);
}
.skipLink:focus { transform: none; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(36, 88, 203, .56); outline-offset: 3px;
}
:where(input, select, textarea):focus-visible { outline: 0; box-shadow: var(--focus-ring); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  border-color: #b8c6d8; font-size: 15px; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #68788d; }
.button { min-height: 42px; box-shadow: none; }
.button.primary { background: var(--primary); box-shadow: none; }
.button.primary:hover { background: var(--primary2); box-shadow: none; }
.button.secondary { color: var(--primary2); border-color: #c4d4f1; background: var(--soft); }
.button.ghost { color: #34445b; background: #fff; border-color: var(--line); }
.button:hover, .quizCard:hover, button.createChoiceCard:hover { transform: none; }
.button:active, button.createChoiceCard:active { transform: translateY(1px); }
.linkButton, .footerLink { color: var(--primary2); }

/* Start: choose an audience, then complete one short task. */
.authIntro { max-width: 1020px; margin: 26px auto 0; }
.authIntro .eyebrow { display: block; margin-bottom: 8px; }
.authIntro h1 { margin: 0 0 7px; font-size: clamp(2rem, 3.4vw, 3.1rem); letter-spacing: -.05em; }
.authIntro p { margin: 0; font-size: 16px; }
.heroGrid { max-width: 1020px; margin: 27px auto 0; gap: 18px; align-items: stretch; }
.heroGrid > .card { padding: 30px; min-height: 370px; }
.heroCard { background: #204caa; border: 1px solid #204caa; box-shadow: var(--shadow); }
.heroCard h2 { margin: 10px 0 8px; font-size: clamp(1.75rem, 2.5vw, 2.25rem); letter-spacing: -.035em; }
.heroCard p { color: #e4ecff; max-width: 35ch; margin: 0 0 28px; font-size: 15px; }
.heroCard .eyebrow { color: #dbe7ff; }
.heroCard .stack label { color: #fff; font-size: 14px; }
.heroCard .button.primary { background: #fff; color: #1949a9; }
.heroCard .button.primary:hover { background: #e9f0ff; }
.heroCard input { border: 1px solid #c5d5f4; }
.heroGrid > .card:not(.heroCard) { display: flex; flex-direction: column; }
.teacherEyebrow { display: block; margin: 1px 0 12px; }
.heroGrid .tabs { margin: 0 0 15px; }
.heroGrid .authForm h2 { font-size: 22px; letter-spacing: -.025em; margin-bottom: 2px; }
.heroGrid .authForm { gap: 13px; }
.heroGrid .authForm .button.primary { margin-top: 5px; }

/* Dashboard: one unmistakable workspace, quick status access, compact jobs. */
#dashboardView > .pageHead {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px; overflow: hidden; isolation: isolate;
  margin: 0 0 24px; padding: 36px 40px 30px; border-radius: 24px;
  background: #112844; color: #fff; box-shadow: 0 18px 40px rgba(17, 40, 68, .14);
}
#dashboardView > .pageHead::after {
  content: ""; position: absolute; z-index: -1; width: 460px; height: 460px;
  right: -110px; bottom: -350px; border-radius: 50%;
  background: radial-gradient(circle, rgba(72, 134, 235, .38), rgba(72, 134, 235, 0) 68%);
  pointer-events: none;
}
#dashboardView > .pageHead > div:first-child { max-width: none; }
#dashboardView > .pageHead .eyebrow { color: #a8d6ff; }
#dashboardView > .pageHead h1 { color: #fff; font-size: clamp(2.35rem, 3.7vw, 3.4rem); margin: 7px 0 4px; }
#dashboardView > .pageHead p { color: #d5e3f5; font-size: 15px; }
#dashboardView .dashboardActions { align-self: start; padding: 0; align-items: center; }
#dashboardView #newQuizBtn { background: #f6f9ff; color: #163b73; font-size: 14px; min-height: 46px; }
#dashboardView #newQuizBtn:hover { background: #e2edff; color: #102e5a; }
#dashboardView #trashBtn { color: #e3eeff; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .23); min-height: 46px; opacity: 1; }
#dashboardView #trashBtn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.dashboardOverview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dashboardMetric {
  display: flex; align-items: baseline; gap: 9px; min-height: 48px; padding: 10px 14px;
  border: 1px solid rgba(227, 239, 255, .25); border-radius: 11px;
  background: rgba(255, 255, 255, .07); color: #f5f9ff; cursor: pointer; text-align: left;
  transition: background .15s, border-color .15s;
}
.dashboardMetric:hover, .dashboardMetric[aria-pressed="true"] { background: rgba(255, 255, 255, .17); border-color: rgba(227, 239, 255, .65); }
.dashboardMetric strong { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.dashboardMetric span { font-size: 12px; font-weight: 650; color: #dbe8f8; }
.dashboardToolbar { margin-bottom: 10px; padding: 16px 18px; background: #fff; backdrop-filter: none; }
.dashboardToolbar label { font-size: 12px; }
.resultsCount { min-height: 20px; margin: 0 2px 16px; font-size: 13px; font-weight: 650; }
.quizGrid { gap: 16px; }
.quizCard { min-height: 0; padding: 21px; background: #fff; border-color: var(--line); box-shadow: var(--shadow); }
.quizCard:before { display: none; }
.quizCard:hover { border-color: #aec5eb; box-shadow: 0 10px 30px rgba(24, 44, 79, .09); }
.quizCard h3 { font-size: 19px; letter-spacing: -.025em; }
.quizCard .meta { color: var(--muted); font-size: 12px; }
.quizStats { margin-top: 2px; gap: 16px; border-color: #e6ebf2; }
.quizStats strong { font-size: 18px; }
.quizStats span { color: var(--muted); }
.primaryQuizActions { margin-top: auto; }
.primaryQuizActions .button { flex: 1 1 auto; min-height: 40px; padding: 9px 10px; }
.quizMore { border-top: 1px solid #e6ebf2; margin-top: 1px; padding-top: 9px; }
.quizMore summary { color: var(--primary2); font-size: 12px; font-weight: 750; cursor: pointer; width: fit-content; }
.quizMore[open] summary { margin-bottom: 10px; }
.quizMore .secondaryQuizActions { padding-top: 4px; border: 0; }
.quizMore .button { min-height: 36px; }
.empty { padding: 48px 20px; }
.empty h2 { margin-bottom: 5px; }
.empty p { margin: 0 auto 18px; }

/* Creation and editing: numbered steps and prominent progress. */
.createChoiceCard { box-shadow: var(--shadow); border-color: var(--line); }
.createChoiceCard:hover { border-color: #9db9eb; box-shadow: 0 10px 28px rgba(24, 44, 79, .1); }
.choiceArrow { color: var(--primary); }
.aiGrid { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); grid-template-areas: "test side"; gap: 18px; align-items: start; }
.aiGrid > .card:nth-child(1) { grid-area: test; }
.aiSideSteps { grid-area: side; display: grid; align-content: start; gap: 18px; min-width: 0; }
.aiGrid > .card { padding: 24px; }
.aiSectionTitle { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.aiSectionTitle > span { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); color: var(--primary2); font-weight: 800; }
.aiSectionTitle h2 { margin: 0; font-size: 21px; }
.aiSectionTitle p { margin: 1px 0 0; font-size: 12px; }
.aiGrid .aiTypePicker { margin: 17px 0; }
.aiGrid .aiOptionalTestOptions { margin-top: 18px; padding: 0 12px; border: 1px solid #cad8eb; border-radius: 12px; background: #f4f8fd; }
.aiGrid .aiOptionalTestOptions > summary { display: flex; min-height: 46px; align-items: center; gap: 8px; color: #34445b; font-weight: 720; cursor: pointer; }
.aiGrid .aiOptionalTestOptions > summary small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 600; }
.aiGrid .aiOptionalTestOptions[open] { padding-bottom: 10px; }
.aiGrid .aiOptionalTestOptions > summary:focus-visible { outline: 2px solid #2f64d6; outline-offset: 2px; border-radius: 6px; }
.aiGrid .aiNotesField { margin-bottom: 0; }
.aiOptionsBlock { padding-top: 16px; border-top: 1px solid var(--line); }
.aiGenerateButton { min-height: 49px; font-size: 15px; }
.aiCostNote { display: block; margin: 12px 0 5px; color: #5a4531; font-weight: 650; }
.aiGenerateButton + .hint { display: block; line-height: 1.45; }
.aiProgress { border-color: #c3d5f3; background: #f4f8ff; }
.aiProgress.error { border-color: #eac2c0; background: #fff5f4; }
.aiJobCard { border-left: 4px solid var(--primary); }
.aiJobCard.aiJobFailed { border-left-color: #b42318; }
#aiJobsList .aiJobCard {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 7px 15px; align-items: center; padding: 17px 20px; border-radius: 16px;
}
.aiJobStatusIcon { display: grid; place-items: center; align-self: start; width: 38px; height: 38px; border-radius: 11px; background: #e9f2ff; color: var(--primary2); font-size: 20px; font-weight: 800; }
.aiJobReady .aiJobStatusIcon { background: #eaf7ef; color: #187346; }
.aiJobFailed .aiJobStatusIcon { background: #fff0ee; color: #a72a23; }
.aiJobBody { min-width: 0; }
#aiJobsList .aiJobCard p { margin: 2px 0 0; font-size: 13px; }
.aiJobActions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.aiJobActions:empty { display: none; }
#aiJobsList .aiJobCard .aiProgressTrack, #aiJobsList .aiJobCard > small { grid-column: 2 / -1; }
#aiJobsList .aiJobCard .button { min-height: 39px; font-size: 12px; white-space: nowrap; }
.importReviewActions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.importReviewActions .button { min-height: 37px; font-size: 12px; }
.stickyHead { background: rgba(245, 247, 251, .97); }
#editorView .stickyHead > div:first-child { flex: 0 1 275px; }
#editorView .stickyHead > .actions { flex: 1; justify-content: flex-end; }
.settingsCard { border-color: var(--line); }
.questionCard, .studentQuestion { border-color: var(--line); box-shadow: var(--shadow); }
.questionCard:focus-within { border-color: #94afe5; }
.studentQuestion .choice:has(input:checked) { background: #eaf1ff; border-color: #779ee6; box-shadow: inset 0 0 0 1px #779ee6; }
.studentQuestion .choice input { accent-color: var(--primary); }
.studentProgressTrack span, .aiProgressFill { background: var(--primary); }
.studentQuestionNav .questionNavDot { min-width: 36px; min-height: 36px; }
.studentHead { background: #204caa; box-shadow: var(--shadow); }

@media (max-width: 1000px) {
  .aiGrid { grid-template-columns: 1fr; grid-template-areas: "test" "side"; }
  #editorView .stickyHead { position: static; flex-direction: column; }
  #editorView .stickyHead > .actions { justify-content: flex-start; }
  #dashboardView > .pageHead { grid-template-columns: 1fr; }
  #dashboardView .dashboardActions { justify-content: flex-start; }
}
@media (max-width: 900px) {
  .heroGrid { grid-template-columns: 1fr; }
  .heroGrid > .card { min-height: 0; }
}
@media (max-width: 700px) {
  .shell { padding-top: 24px; }
  #dashboardView > .pageHead { padding: 27px 22px; border-radius: 19px; gap: 18px; }
  #dashboardView > .pageHead h1 { font-size: 2.35rem; }
  #dashboardView .dashboardActions { width: 100%; }
  #dashboardView .dashboardActions .button { flex: 1 1 auto; }
  .dashboardMetric { flex: 1 1 138px; }
  #aiJobsList .aiJobCard { grid-template-columns: 38px minmax(0, 1fr); padding: 16px; gap: 8px 12px; }
  .aiJobActions { grid-column: 2; justify-content: flex-start; }
  .aiJobActions .button { white-space: normal; }
  .importReviewActions { grid-column: 2; justify-content: flex-start; }
  .importReviewActions .closeImportReview { margin-top: 0; }
  .authIntro { margin-top: 12px; }
  .authIntro p { font-size: 14px; }
  .heroGrid { margin-top: 20px; }
  .heroGrid > .card { padding: 22px; }
  .heroCard p { margin-bottom: 18px; }
  .quizMore .secondaryQuizActions .button { flex: 1 1 46%; }
  .aiGrid > .card { padding: 20px; }
  .aiSectionTitle { margin-bottom: 18px; }
  .studentQuestion .choice { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* The teacher's core test settings should read as a short, touch-friendly form on phones. */
@media (max-width: 700px) {
  #aiView { margin-top: -12px; }
  #aiView > .pageHead { margin-bottom: 8px; gap: 8px; }
  #aiView > .pageHead .linkButton.left { min-height: 44px; margin-bottom: 6px; }
  #aiView > .pageHead .eyebrow { display: none; }
  #aiView .aiPageHeadContent { gap: 8px; }
  #aiView .aiPageHeadText h1 { margin: 1px 0 4px; font-size: 25px; line-height: 1.12; }
  #aiView .aiPageHeadText p { display: block; margin: 3px 0 0; font-size: 12px; line-height: 1.35; }
  #aiView .aiPageRemyHero { flex-basis: 82px; width: 82px; height: 84px; }
  #aiView .aiDataNote { margin: 0 0 8px; line-height: 1.35; }
  #aiView .aiGrid { gap: 10px; }
  #aiView .aiSideSteps { gap: 10px; }
  #aiView .aiGrid > .card { padding: 12px; border-radius: 13px; }
  #aiView .aiSectionTitle { gap: 9px; margin-bottom: 12px; }
  #aiView .aiSectionTitle > span { flex-basis: 30px; width: 30px; height: 30px; border-radius: 9px; }
  #aiView .aiSectionTitle h2 { font-size: 18px; }
  #aiView .aiSectionTitle p { line-height: 1.35; }
  #aiView .formGrid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  #aiView .formGrid2 .span2 { grid-column: 1 / -1; }
  #aiView .formGrid2 label { min-width: 0; gap: 3px; font-size: 12px; line-height: 1.2; }
  #aiView .formGrid2 :is(input, select) { min-height: 44px; padding: 7px 9px; font-size: 16px; line-height: 1.25; }
  #aiView .aiTypePicker { margin: 8px 0 10px; padding: 7px 9px; }
  #aiView .aiTypePicker summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  #aiView .aiTypePicker summary span { float: none; text-align: right; }
  #aiView .aiNotesField { gap: 4px; margin: 4px 0 8px; font-size: 12px; }
  #aiView #aiCustomNotes { height: 78px; min-height: 78px; padding: 8px 10px; font-size: 16px; line-height: 1.35; }
  #aiView .gcRemyCreatePanel { grid-template-columns: 56px minmax(0, 1fr); gap: 6px; margin: 0 0 8px; padding: 8px; border-radius: 14px; }
  #aiView .gcRemyCreateMascot { width: 56px; height: 60px; }
  #aiView .gcRemyCreateHead { gap: 5px; margin: 0 0 3px; }
  #aiView .gcRemyCreateHead strong { font-size: 14px; }
  #aiView .gcRemyCreateHead span { font-size: 11px; line-height: 1.2; }
  #aiView .gcRemyCreateForm { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 5px; }
  #aiView .gcRemyCreateForm textarea { min-height: 44px; max-height: 66px; padding: 6px 7px; font-size: 16px; line-height: 1.25; }
  #aiView :is(.gcRemyCreateMic, .gcRemyCreateSend) { width: 44px; height: 44px; }
  #aiView .gradecrewPreferenceDetails { margin: 8px 0 2px; padding-top: 7px; }
  #aiView .gradecrewPreferenceDetails summary { min-height: 44px; display: flex; align-items: center; }
  #aiView #aiPointsHint:empty { display: none; }
  #aiView :is(.aiOptionalTestOptions, .aiOptionalMedia, .aiOptionalAudio) { margin-top: 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
  #aiView .aiOptionalTestOptions { border-color: #cad8eb; background: #f4f8fd; }
  #aiView :is(.aiOptionalTestOptions, .aiOptionalMedia, .aiOptionalAudio) > summary { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
  #aiView :is(.aiOptionalTestOptions, .aiOptionalMedia, .aiOptionalAudio) > summary small { color: var(--muted); font-size: 11px; font-weight: 600; }
  #aiView :is(.aiOptionalTestOptions[open], .aiOptionalMedia[open], .aiOptionalAudio[open]) { padding-bottom: 9px; }
  #aiView .aiCoreActions { display: grid; gap: 5px; margin-top: 8px; }
  #aiView .aiCoreActions > .hint, #aiView .aiCoreActions > small { margin: 0; }
  #aiView .aiCoreActions .aiCostNote { line-height: 1.35; }
  #aiView .aiGenerateButton { min-height: 48px; margin-top: 2px; }
  #aiView .aiUploadNotice { margin: 8px 0; padding: 9px 10px; }
  #aiView .aiUploadBox { padding: 11px; }
  #aiView .aiMaterialOptions, #aiView .aiAudioOptions { margin-top: 9px; padding: 10px; }
  #aiView .aiMaterialOptions h3, #aiView .aiAudioOptions h3 { margin-bottom: 6px; }
  #aiView .aiGenerateButton { min-height: 48px; margin-top: 8px; }
  #aiView .aiCostNote { margin: 8px 0 4px; }
}

@media (max-width: 375px) {
  #aiView { margin-top: -35px; }
  #aiView .aiDataNote { margin-bottom: 6px; font-size: 11px; line-height: 1.25; }
  #aiView .aiGrid > .card { padding: 8px; }
  #aiView .aiSectionTitle { margin-bottom: 6px; }
  #aiView .formGrid2 { row-gap: 1px; }
  #aiView .formGrid2 label { gap: 2px; }
  #aiView .aiCoreActions > small:last-child { display: none; }
  #aiView .aiCoreActions { gap: 3px; }
  #aiView .aiCoreActions .aiCostNote { font-size: 11px; line-height: 1.2; }
  #aiView .aiGenerateButton { min-height: 44px; }
  #aiView .aiPageHeadContent { gap: 6px; }
  #aiView .aiPageHeadText h1 { font-size: 23px; }
  #aiView .aiPageRemyHero { flex-basis: 76px; width: 76px; height: 78px; }
  #aiView .gcRemyCreatePanel { grid-template-columns: 52px minmax(0, 1fr); gap: 4px; margin-bottom: 4px; padding: 4px; }
  #aiView .gcRemyCreateMascot { width: 52px; height: 56px; }
}
