:root {
  --ink: #1d2433;
  --ink-soft: #545e70;
  --paper: #ffffff;
  --surface: #f3f5f7;
  --line: #d9dee5;
  --primary: #1b4b8f;
  --primary-dark: #143a70;
  --final: #1e6b45;
  --final-dark: #165335;
  --final-bg: #e6f3ec;
  --late: #8a5100;
  --late-bg: #fff3df;
  --error: #a1261b;
  --error-bg: #fcebea;
  --radius-sm: 4px;
  --radius-md: 8px;
  --sans: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 1rem; line-height: 1.55; color: var(--ink); background: var(--surface); }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 3px solid #7aa7e6; outline-offset: 2px; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 66rem; margin: 0 auto; padding: .75rem 1.25rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.who { color: var(--ink-soft); font-size: .9rem; }
.topbar nav a { margin-right: 1rem; font-size: .95rem; }

main { max-width: 66rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .25rem 0 .5rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
p { margin: .4rem 0 .9rem; max-width: 70ch; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.ar { font-family: "IBM Plex Sans Arabic", Tahoma, sans-serif; }
code, .mono { font-family: var(--mono); font-size: .9em; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.25rem; margin: 1rem 0; }
.narrow { max-width: 26rem; margin: 2.5rem auto; }
.grid-2 > .panel { margin: 0; }
.file-row { display: flex; gap: 1rem; align-items: baseline; margin: .2rem 0 .6rem; }
.grid-2 { margin: 1rem 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }

label { display: block; font-weight: 500; margin: .75rem 0 .25rem; }
.hint { font-weight: 400; color: var(--ink-soft); font-size: .85rem; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], input[type=file] {
  width: 100%; font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink);
}
input[type=file] { padding: .4rem; }
.checks label { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .3rem 0; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1 1 10rem; }

.btn { display: inline-block; font: inherit; font-weight: 500; padding: .5rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: var(--paper); color: var(--primary); }
.btn-outline:hover { background: #eaf1fb; color: var(--primary-dark); }
.btn-final { background: var(--final); border-color: var(--final); }
.btn-final:hover { background: var(--final-dark); }
.btn-link { background: none; border: none; color: var(--primary); padding: 0; font-weight: 400; text-decoration: underline; cursor: pointer; font: inherit; }
.btn-danger-link { color: var(--error); }
form.inline { display: inline; }

.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); margin: .5rem 0; border: 1px solid; }
.flash.success { background: var(--final-bg); border-color: #b5dac5; color: var(--final-dark); }
.flash.error { background: var(--error-bg); border-color: #f0bdb8; color: var(--error); }

table { width: 100%; border-collapse: collapse; background: var(--paper); font-size: .93rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-soft); font-size: .85rem; background: var(--surface); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.table-wrap table tr:last-child td { border-bottom: none; }

.tag { display: inline-block; font-size: .8rem; font-weight: 500; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); white-space: nowrap; }
.tag.final { background: var(--final-bg); border-color: #b5dac5; color: var(--final-dark); }
.tag.late { background: var(--late-bg); border-color: #f1d3a3; color: var(--late); }

.deadline { font-size: 1.05rem; }
.deadline.passed { color: var(--late); }

/* The submit panel: the one place where the design speaks up */
.submit-panel { border: 2px solid var(--primary); }
.submit-panel.locked { border-color: var(--final); background: var(--final-bg); }
.filename-preview { font-family: var(--mono); font-size: 1rem; background: var(--surface); border: 1px dashed var(--line); padding: .45rem .65rem; border-radius: var(--radius-sm); display: inline-block; word-break: break-all; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.actions .btn { min-width: 9rem; text-align: center; }
.callout { border-left: 4px solid var(--late); background: var(--late-bg); padding: .6rem .9rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: .75rem 0; }
.callout.final { border-color: var(--final); background: var(--final-bg); }

.stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.stats div { font-size: .9rem; color: var(--ink-soft); }
.stats strong { display: block; font-size: 1.3rem; color: var(--ink); }

@media (max-width: 40rem) {
  main { padding: 1rem .9rem 3rem; }
  .panel { padding: 1rem; }
  th, td { padding: .5rem .45rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- v1.2: dates, email step, warnings ---------- */
.flash.warning { background: var(--late-bg); border-color: #f1d3a3; color: #6b3f00; font-weight: 500; }
.nowrap { white-space: nowrap; }
.eyebrow { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 .35rem; }
.must { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: var(--error); border-radius: 999px; padding: .05rem .5rem; vertical-align: .1em; }

.dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .5rem; margin: .75rem 0 .35rem; }
.date-cell { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius-md); padding: .6rem .8rem; display: flex; flex-direction: column; gap: .1rem; }
.date-cell.ontime { border-top-color: var(--final); }
.date-cell.late { border-top-color: #d08a1c; }
.date-cell.closed { border-top-color: #9aa3b0; }
.date-cell.now { box-shadow: 0 0 0 2px var(--primary) inset; }
.date-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
.date-cell strong { font-size: 1rem; }
.date-note { font-size: .85rem; color: var(--ink-soft); }

.mini-steps { margin: .25rem 0 .5rem; padding-left: 1.2rem; }
.mini-steps li { margin: .35rem 0; }

.email-panel { border-color: var(--error); background: #fff8f7; }
.email-panel h2 { margin: .15rem 0 .5rem; color: var(--error); }
.email-steps { padding-left: 1.2rem; margin: .75rem 0; }
.email-steps li { margin: 0 0 1rem; }
.email-steps li > span { display: block; margin-bottom: .45rem; }
.email-steps .btn { margin: 0 .5rem .35rem 0; }
.email-steps code { font-family: var(--mono); background: var(--surface); padding: .05rem .35rem; border-radius: var(--radius-sm); }
.closed-panel { border-color: #9aa3b0; background: var(--surface); }
.closed-panel h2 { margin-top: 0; }

/* ---------- v1.2: public student guide (/help) ---------- */
.guide { max-width: 46rem; margin: 0 auto; }
.guide section { margin: 2.25rem 0; }
.guide h2 { font-size: 1.35rem; margin: 0 0 .9rem; }
.guide h3 { font-size: 1.05rem; }
.guide-hero { padding: 1rem 0 .5rem; }
.guide-hero h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); margin: .2rem 0 .6rem; }
.guide .lead { font-size: 1.1rem; color: var(--ink); }

.two-places { background: var(--paper); border: 2px solid var(--error); border-radius: 12px; padding: 1.25rem; }
.two-places h2 { color: var(--error); }
.places { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: stretch; }
.place { border: 1px solid var(--line); border-radius: var(--radius-md); padding: .9rem 1rem; background: var(--surface); position: relative; }
.place h3 { margin: .25rem 0 .35rem; }
.place p { margin: .2rem 0; }
.place-num { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 600; }
.place-detail { font-size: .92rem; color: var(--primary-dark); word-break: break-all; }
.places-and { align-self: center; font-weight: 700; color: var(--error); text-transform: uppercase; font-size: .85rem; letter-spacing: .06em; }
.places-warning { margin: .9rem 0 0; font-weight: 600; }

.hw-dates { margin-bottom: 1rem; }
.hw-dates h3 { margin: 0 0 .25rem; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.step { counter-increment: step; position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1rem 1.1rem 1rem 3.6rem; margin: 0 0 .85rem; }
.step::before { content: counter(step); position: absolute; left: 1rem; top: 1rem; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 600; display: grid; place-items: center; }
.step h3 { margin: .2rem 0 .5rem; }
.step p, .step ul, .step ol { margin: .4rem 0; }
.step ul, .step ol { padding-left: 1.2rem; }
.step li { margin: .3rem 0; }
.step-must { border: 2px solid var(--error); background: #fff8f7; }
.step-must::before { background: var(--error); }
.ui { font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 .3rem; -webkit-box-decoration-break: clone; box-decoration-break: clone; overflow-wrap: anywhere; }
.btn-sample { border-color: var(--primary); color: var(--primary); }
.btn-sample.final { background: var(--final); border-color: var(--final); color: #fff; }
kbd { font-family: var(--mono); font-size: .82em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--radius-sm); padding: 0 .3rem; background: var(--paper); }
.sample-name { display: inline-block; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .3rem .6rem; word-break: break-all; }
.note { border-left: 4px solid var(--primary); background: #eef3fb; padding: .5rem .8rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.rules { background: var(--surface); border-radius: var(--radius-md); padding: .7rem .9rem; margin-top: .6rem; }
.rules-title { font-weight: 600; margin: 0 0 .3rem !important; }

.checklist { list-style: none; padding-left: 0 !important; }
.checklist li { position: relative; padding-left: 1.6rem; }
.checklist li::before { content: ""; position: absolute; left: .1rem; top: .3em; width: .95rem; height: .95rem; border: 2px solid var(--final); border-radius: 3px; }
.checklist.big li { margin: .5rem 0; }

.policy { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; }
.policy ul { padding-left: 1.2rem; }
.policy li { margin: .45rem 0; }
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border-radius: var(--radius-md); overflow: hidden; margin-bottom: 1rem; }
.tl { padding: .75rem .9rem; display: flex; flex-direction: column; gap: .1rem; color: #fff; }
.tl strong { font-size: 1.05rem; }
.tl span { font-size: .9rem; opacity: .95; }
.tl em { font-style: normal; font-weight: 600; margin-top: .2rem; }
.tl.ontime { background: var(--final); }
.tl.late { background: #b56f0c; }
.tl.closed { background: #5d6675; }

table.errors td:first-child { font-family: var(--mono); font-size: .85rem; width: 46%; }
.faq details { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .65rem .9rem; margin: 0 0 .5rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: .5rem 0 .2rem; }
.guide-foot { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.25rem; text-align: center; }

@media (max-width: 40rem) {
  .places { grid-template-columns: 1fr; }
  .places-and { justify-self: center; }
  .step { padding-left: 1rem; padding-top: 3.2rem; }
  .step::before { top: .9rem; }
  .two-places, .policy { padding: 1rem; }
  table.errors td:first-child { width: auto; }
  .tl { padding: .6rem .55rem; }
  .tl strong { font-size: .95rem; }
  .tl span, .tl em { font-size: .8rem; }
}
@media print {
  .topbar, .actions, .guide-foot .btn { display: none; }
  body { background: #fff; }
  .faq details { break-inside: avoid; }
}
