@font-face {
  font-family: Plex Arabic;
  src: url("IBMPlexSansArabic-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Plex Arabic;
  src: url("IBMPlexSansArabic-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --navy: #100051;
  --navy-hover: #241587;
  --teal: #01f9af;
  --workspace: #f4f6f9;
  --surface: #fff;
  --surface-subtle: #f6f8fa;
  --ink: #161532;
  --muted: #585e72;
  --border: #e7eaf0;
  --field-border: #c8cedb;
  --link: #095c74;
  --good: #145445;
  --good-bg: #e4f5ee;
  --warn: #754a0a;
  --warn-bg: #fbf0d9;
  --danger: #a42630;
  --danger-bg: #fbe9ea;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font: 1rem/1.65 "Plex Arabic", system-ui, sans-serif;
  background: var(--workspace);
  color: var(--ink);
}
h1, h2, p, dl, ol, ul { margin: 0; }
h1, h2 { line-height: 1.35; color: var(--navy); overflow-wrap: anywhere; }
h1 { font-size: clamp(1.52rem, 4.4vw, 1.9rem); }
h2 { font-size: 1.12rem; }
a { color: var(--link); text-underline-offset: .19em; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #16778a; outline-offset: 3px; }
.topbar { background: var(--navy); color: white; }
.topbar-inner {
  max-width: 72rem;
  margin-inline: auto;
  padding: .8rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  min-height: 44px;
  gap: .8rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: .98rem;
}
.brand img { flex: 0 0 auto; width: 2.1rem; height: 2.1rem; object-fit: contain; }
.top-action {
  min-height: 44px;
  color: white;
  background: transparent;
  border: 1px solid #8378b8;
  border-radius: 10px;
  padding-inline: .88rem;
}
.top-action:hover { background: var(--navy-hover); }
main { margin: 2.5rem auto 3.5rem; padding-inline: 1rem; }
.narrow { max-width: 42rem; }
.auth { max-width: 32rem; }
.wide { max-width: 68rem; }
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 20px;
  padding: clamp(1.1rem, 4vw, 2rem);
  box-shadow: 0 2px 8px #16153207;
}
.student-card { display: grid; gap: 1.45rem; }
.intro p, .page-head p, .blank p, .exam-description p { margin-top: .35rem; color: var(--muted); }
.fields { display: grid; gap: .5rem; }
.fields > :is(input, select, .grid) + label, .fields > .grid { margin-top: .55rem; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > div { display: grid; gap: .4rem; }
label, legend { color: var(--navy); font-weight: 700; }
input:not([type=hidden]), select {
  display: block;
  background: var(--surface-subtle);
  color: var(--ink);
  min-height: 48px;
  min-width: 0;
  width: 100%;
  padding: .55rem .75rem;
  border-radius: 11px;
  border: 1px solid var(--field-border);
}
input::placeholder { color: #626b80; opacity: 1; }
select {
  appearance: none;
  padding-inline-end: 2.5rem;
  background-image: url("chevron.svg");
  background-repeat: no-repeat;
  background-size: .85rem;
  background-position: left .85rem center;
  text-overflow: ellipsis;
}
input[type=file] {
  background: white;
  padding: .2rem;
  border: 1px dashed #8992a7;
}
input[type=file]::file-selector-button {
  font: inherit;
  min-height: 44px;
  background: #ecebf6;
  color: var(--navy);
  border: 0;
  border-radius: 8px;
  margin-inline-end: .5rem;
  padding-inline: .7rem;
  cursor: pointer;
}
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: .52rem .95rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  line-height: 1.35;
}
.primary { background: var(--navy); color: white; }
.primary:hover { background: var(--navy-hover); }
.primary:not(:disabled):active { transform: translateY(1px); }
.student-card .primary { background: var(--teal); color: var(--navy); }
.student-card .primary:hover { background: #00e6a1; }
.secondary { color: var(--navy); background: white; border-color: var(--field-border); }
.secondary:hover { background: var(--surface-subtle); }
.full { width: 100%; }
.fields > .primary { margin-top: .6rem; }
:disabled { cursor: not-allowed; }
.student-card .primary:disabled { background: #e7ebf2; color: #555c70; }
.upload-fields { padding: .75rem 0 0; margin: 1.45rem 0 0; border: 0; min-width: 0; }
.upload-fields legend { padding: 0; }
.file-picker { display: none; }
.enhanced input.native-file {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
.enhanced .file-picker {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: .5rem .75rem;
  border: 1px dashed #8992a7;
  border-radius: 11px;
  background: var(--surface-subtle);
  cursor: pointer;
}
.enhanced .file-picker:hover { background: #ecebf6; }
.native-file:focus-visible + .file-picker { outline: 3px solid #16778a; outline-offset: 3px; }
.upload-fields:disabled .file-picker { cursor: not-allowed; color: var(--muted); }
.upload-fields .primary { margin-top: 1.15rem; }
.help { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.upload-fields .help { margin-bottom: .6rem; }
#file-list { margin: .45rem 0 0; }
.notice, .schedule {
  padding: .65rem .85rem;
  border-radius: 10px;
  font-size: .92rem;
  overflow-wrap: anywhere;
}
.schedule { margin-top: .42rem; }
.notice.error { background: var(--danger-bg); color: var(--danger); }
.empty-state, .schedule.upcoming, .schedule.closed { background: var(--surface-subtle); color: var(--muted); }
.empty-state { margin-top: .42rem; }
.upload-feedback { margin-top: 1rem; display: grid; gap: .32rem; }
progress { width: 100%; accent-color: #008c69; }
#upload-error { margin-top: 1rem; }
.success-mark {
  background: var(--good-bg);
  color: var(--good);
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.45rem;
  font-weight: 700;
}
.facts > div { display: flex; gap: .75rem; justify-content: space-between; padding: .65rem 0; border-block-end: 1px solid var(--border); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: end; overflow-wrap: anywhere; font-weight: 700; }
.page-head, .section-head, .exam-row, .exam-actions, .attempt-head {
  display: flex;
  gap: .7rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.page-head { margin-bottom: 1rem; }
.section-head { margin-bottom: .95rem; }
.exam-description { min-width: 0; }
.exam-description h2 a { color: var(--navy); text-decoration: none; }
.exam-description h2 a:hover { text-decoration: underline; }
.exam-description p { font-size: .9rem; }
.exam-list, .attempts, .file-list { list-style: none; padding: 0; }
.exam-row { padding: .9rem 0; border-block-end: 1px solid var(--border); }
.exam-list + .help { margin-top: .7rem; }
.exam-row:first-child { padding-top: 0; }
.pill { display: inline-flex; width: fit-content; flex-shrink: 0; border-radius: 99px; padding: .18rem .62rem; font-size: .84rem; }
.pill.upcoming { background: #ecebf6; color: var(--navy); }
.pill.closed { background: #eef1f6; color: var(--muted); }
.open { background: var(--good-bg); color: var(--good); }
.grace { background: var(--warn-bg); color: var(--warn); }
.blank { text-align: center; padding: 1.8rem .2rem; }
.search { display: flex; gap: .5rem; width: min(100%, 19rem); }
.student-group { border-block-start: 1px solid var(--border); }
.student-group summary { min-height: 50px; padding: .65rem .25rem; color: var(--navy); }
.student-group summary strong { overflow-wrap: anywhere; }
.student-group summary .help { margin-inline-start: .7rem; }
.attempts { padding: 0 .85rem .75rem; }
.attempts > li { background: var(--surface-subtle); border-radius: 12px; padding: .8rem; }
.attempts > li + li, .file-list li + li { margin-top: .55rem; }
.attempt-head { justify-content: start; }
.attempt-head small, .file small { color: var(--muted); }
.file-list { margin-top: .55rem; }
.file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  min-height: 44px;
  border-radius: 8px;
  background: white;
  padding: .35rem .7rem;
  overflow-wrap: anywhere;
}
.back { display: inline-flex; align-items: center; min-height: 44px; margin: -.25rem 0 .5rem; }
.visually-hidden { position: absolute; height: 1px; width: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 500px) {
  .topbar-inner { padding-inline: 1rem; }
  main { margin-top: 1.15rem; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .page-head, .section-head { align-items: flex-start; }
  .facts > div { flex-wrap: wrap; gap: .22rem .75rem; }
  .attempts { padding-inline: 0; }
}
