/* Shared look for the lecturer pages and the admin login (allauth).
   No external fonts or CDNs; no inline styles (blocked by the CSP). */

:root {
  /* Colours of harvard-club.de: crimson, dark grey text, light grey surfaces */
  --brand: #a41034;
  --brand-dark: #7d0c27;
  --brand-soft: #f7e7eb;
  --bg: #f3f3f3;
  --surface: #ffffff;
  --text: #333333;
  --muted: #666666;
  --line: #e1e1e1;
  --ok: #1d7a4a;      --ok-soft: #e3f4ea;
  --warn: #9a6200;    --warn-soft: #fdf1dc;
  --danger: #b42318;  --danger-soft: #fdecea;
  --info: #3f3f3f;    --info-soft: #ececec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 700; }
h1, h2 { color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; }
small, .muted { color: var(--muted); }

/* --- Top bar ------------------------------------------------------------- */
.topbar { background: var(--brand); color: #fff; border-top: 4px solid var(--brand-dark); }
.topbar-inner {
  max-width: 72rem; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none;
  font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.brand:hover { color: #fff; }
.brand-logo { height: 2.4rem; width: auto; }
.topnav { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-left: auto; font-size: .95rem; }
.topnav a { color: rgba(255, 255, 255, .85); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover, .topnav a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }
@media (max-width: 700px) { .topbar-inner { flex-wrap: wrap; } .topnav { order: 3; width: 100%; margin-left: 0; } }
.user { display: flex; align-items: center; gap: .75rem; font-size: .95rem; }
.user form { margin: 0; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}

/* --- Layout ------------------------------------------------------------------ */
.page { max-width: 72rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-narrow { max-width: 30rem; margin: 0 auto; padding: 4rem 1.25rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: 0; }
.back { display: inline-block; margin-bottom: 1rem; text-decoration: none; font-size: .95rem; }
.grid { display: grid; gap: 1.5rem; }
.grid-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); align-items: start; }
.stack > * + * { margin-top: 1.5rem; }
@media (max-width: 900px) { .grid-detail { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem;
}
.card > h2:first-child { margin-bottom: 1rem; }
.sticky { position: sticky; top: 1.25rem; }
@media (max-width: 900px) { .sticky { position: static; } }

/* --- Stats ------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .9rem; }

/* --- Badges ------------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--info-soft); color: var(--info);
}
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge-assigned { background: var(--info-soft); color: var(--info); }
.badge-in_progress { background: var(--warn-soft); color: var(--warn); }
.badge-submitted { background: var(--ok-soft); color: var(--ok); }
.badge-conflict { background: #eef0f3; color: var(--muted); }
.badge-overdue { background: var(--danger-soft); color: var(--danger); }
.due { font-size: .85rem; color: var(--muted); }
.due-soon { color: var(--warn); font-weight: 600; }
.due-over { color: var(--danger); font-weight: 600; }

/* --- Assignment list ----------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1rem 1.5rem;
  padding: 1rem 1.25rem; border-top: 1px solid var(--line);
}
.list-item:first-child { border-top: 0; }
.list-item .name { text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.list-card { padding: 0; overflow: hidden; }
@media (max-width: 640px) { .list-item { grid-template-columns: 1fr; gap: .5rem; } }

/* --- Application data ------------------------------------------------------------ */
.fields { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: .65rem 1.25rem; margin: 0; }
.fields dt { color: var(--muted); font-size: .9rem; }
.fields dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; gap: .1rem; } .fields dd { margin-bottom: .6rem; } }

.files { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.file {
  display: flex; align-items: center; gap: .9rem; padding: .8rem 1rem; border: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: var(--text); background: #fbfcfd;
}
.file:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.file-icon {
  flex: none; width: 2.4rem; height: 2.8rem; border-radius: 6px; background: var(--danger-soft); color: var(--danger);
  display: grid; place-items: center; font-size: .7rem; font-weight: 800; letter-spacing: .03em;
}
.file-name { display: block; font-weight: 600; }
.file-meta { display: block; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.file-actions { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem 1rem; }
.file-actions a { font-size: .9rem; color: var(--brand); white-space: nowrap; text-decoration: none; }
.file-actions a:hover { text-decoration: underline; }

/* --- Review form ---------------------------------------------------------------- */
.criterion { border: 0; padding: 0; margin: 0 0 1.4rem; min-width: 0; }
.criterion-head { width: 100%; padding: 0; display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.criterion-help { font-size: .88rem; color: var(--muted); margin: .15rem 0 .6rem; }
.scale { display: flex; flex-wrap: wrap; gap: .35rem; border: 0; padding: 0; margin: 0; }
.scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale label {
  min-width: 2.25rem; height: 2.25rem; padding: 0 .5rem; border: 1px solid var(--line); border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; font-weight: 600; font-variant-numeric: tabular-nums;
  background: #fff; user-select: none;
}
.scale label:hover { border-color: var(--brand); }
.scale input:checked + label { background: var(--brand); border-color: var(--brand); color: #fff; }
.scale input:focus-visible + label { outline: 3px solid rgba(164, 16, 52, .35); outline-offset: 1px; }

.total {
  display: flex; justify-content: space-between; align-items: baseline; padding: .9rem 1rem; margin: .5rem 0 1rem;
  border-radius: 10px; background: var(--brand-soft); font-weight: 600;
}
.total-value { font-size: 1.4rem; font-variant-numeric: tabular-nums; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.hint { font-size: .85rem; color: var(--muted); margin: .75rem 0 0; }

.scores { display: grid; gap: .8rem; margin: 0 0 1rem; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center; }
.score-row meter { grid-column: 1 / -1; width: 100%; height: .5rem; }
.notes { white-space: pre-wrap; background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; }

details.aside { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
details.aside summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
details.aside[open] summary { margin-bottom: .75rem; }

/* --- Forms & buttons ------------------------------------------------------------- */
label { font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea, select {
  width: 100%; font: inherit; color: inherit; padding: .6rem .75rem; border: 1px solid #c9d1dc; border-radius: 8px; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(164, 16, 52, .25); border-color: var(--brand); }
textarea { resize: vertical; }
form p { margin: 0 0 1rem; }
form p label { display: block; margin-bottom: .3rem; }
form p input[type=text] + input[type=text] { margin-top: .5rem; } /* address: street, then postcode and town */
/* Date: text field TT.MM.JJJJ + calendar button (datepicker.js); the native picker input stays invisible. */
.date-field { position: relative; display: flex; gap: .5rem; align-items: stretch; max-width: 16rem; }
.date-field input[type=text] { flex: 1; }
.date-button { padding: 0 .75rem; line-height: 1; }
.date-picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }
.allauth main form p:has(input[type=checkbox]) label { display: inline; margin-left: .4rem; }
.helptext, form p span.helptext { display: block; font-size: .85rem; color: var(--muted); font-weight: 400; margin-top: .25rem; }

button, .button {
  font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none;
}
button:hover, .button:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.button-secondary, button.button-secondary { background: #fff; color: var(--brand); border-color: #c9d1dc; }
.button-secondary:hover, button.button-secondary:hover { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.button-quiet, button.button-quiet { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); padding: .35rem .8rem; font-size: .9rem; }
.button-quiet:hover, button.button-quiet:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }
.button-danger, button.button-danger { background: #fff; color: var(--danger); border-color: #e9b4ae; }
.button-danger:hover, button.button-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.button-block { width: 100%; }

.errorlist { list-style: none; margin: .35rem 0 0; padding: 0; color: var(--danger); font-size: .88rem; font-weight: 600; }

/* --- Messages / empty states ------------------------------------------------------ */
.messages { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .5rem; }
.message { padding: .8rem 1rem; border-radius: 10px; background: var(--info-soft); color: var(--info); border: 1px solid #e1c4cb; }
.message.success { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cd; }
.message.error, .message.warning { background: var(--danger-soft); color: var(--danger); border-color: #f2c4bf; }
.notice { padding: 1rem 1.25rem; border-radius: 10px; background: #eef0f3; color: var(--text); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* --- Centered entrance pages (magic link, admin login) ----------------------------- */
.entrance { text-align: left; }
.entrance h1 { font-size: 1.5rem; }
.login-choices { list-style: none; margin: 1rem 0 1.5rem; padding: 0; display: grid; gap: 1rem; }
.footer-note { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 1.5rem; }

/* allauth renders plain elements; give them the same rhythm */
.allauth main ul { padding-left: 1.2rem; }
.allauth main hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.allauth main form button { margin-top: .25rem; }
.allauth main img { max-width: 100%; height: auto; background: #fff; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; }
.allauth main table { width: 100%; border-collapse: collapse; }
.allauth main th, .allauth main td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); }

/* Public application form */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
input[type=file] { font: inherit; }
.grid-detail:has(> form:only-child) { grid-template-columns: minmax(0, 46rem); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .pre { white-space: pre-line; }
.contacts { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.badge-interview { background: var(--brand-soft); color: var(--brand); margin-left: .4rem; }
.section-head { margin-top: 2.5rem; }
