/* Master's Student Management -- mockup styles.
   One stylesheet, no framework, no build step. */

:root {
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --line:      #dfe4ec;
  --line-soft: #eef1f6;
  --ink:       #1c2536;
  --ink-soft:  #5b6779;
  --ink-faint: #8b95a6;
  --accent:    #1f4e8c;
  --accent-bg: #e8eff9;
  --high:      #b3261e;
  --high-bg:   #fdeceb;
  --warn:      #8a5a00;
  --warn-bg:   #fdf3e0;
  --ok:        #1c6b3f;
  --ok-bg:     #e7f4ec;
  --radius:    8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------------------------------------------------------------- header */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--ink-faint); font-size: 12px; }

.mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.identity { display: flex; align-items: center; gap: 10px; }
.identity label { color: var(--ink-faint); font-size: 12px; }

select, input[type="search"], input[type="text"], input[type="date"], textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
}
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--accent-bg);
  border-color: var(--accent);
}

/* ------------------------------------------------------------------ tabs */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  font: inherit;
  border: 0;
  background: none;
  color: var(--ink-soft);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

main { padding: 20px 24px 60px; max-width: 1400px; margin: 0 auto; }
/* Utility -- must beat the display rules on buttons and links further down. */
.view.hidden, .hidden { display: none !important; }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 2px; font-size: 14px; letter-spacing: -0.01em; }
.hint { margin: 0 0 12px; color: var(--ink-faint); font-size: 12px; }

.grid-2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ stat cards */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .n { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.stat .k { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.stat.alert .n { color: var(--high); }
.stat.warn  .n { color: var(--warn); }

/* ---------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  white-space: nowrap;
}
table.data td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f7f9fc; }

table.mini td { padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
table.mini tr:last-child td { border-bottom: 0; }
table.mini td:last-child { text-align: right; color: var(--ink-soft); white-space: nowrap; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--ink-faint); }

/* --------------------------------------------------------------- badges */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line-soft);
  color: var(--ink-soft);
}
.badge.role       { background: var(--accent-bg); color: var(--accent); text-transform: capitalize; }
.badge.active     { background: var(--accent-bg); color: var(--accent); }
.badge.submitted  { background: #ede8fb; color: #52389c; }
.badge.completed  { background: var(--ok-bg);   color: var(--ok); }
.badge.leave      { background: var(--warn-bg); color: var(--warn); }
.badge.withdrawn  { background: #eceef2;        color: var(--ink-faint); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.dot.high { background: var(--high); }
.dot.warn { background: #d99100; }
.dot.ok   { background: #3a9c68; }

/* ------------------------------------------------------------- progress */

.bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar .track { flex: 1; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.bar .fill  { height: 100%; background: var(--accent); border-radius: 3px; }
.bar .pct   { font-size: 11px; color: var(--ink-faint); width: 30px; text-align: right; }

/* ------------------------------------------------------------ risk list */

.risk-list { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--high);
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}
.risk-item:hover { background: var(--high-bg); }
.risk-item .who { font-weight: 600; }
.risk-item .why { color: var(--ink-soft); font-size: 12px; }

/* -------------------------------------------------------------- filters */

.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters #fq { flex: 1; min-width: 240px; }
.spacer { flex: 1; }

button.ghost, a.btn {
  font: inherit;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.ghost:hover, a.btn:hover { background: #f7f9fc; color: var(--ink); }

button.primary {
  font: inherit;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: #173d70; }
button.primary:disabled { opacity: 0.5; cursor: default; }

/* ----------------------------------------------------------- side panel */

.overlay {
  position: fixed; inset: 0;
  background: rgba(20, 28, 42, 0.35);
  z-index: 10;
}
.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(620px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(20, 28, 42, 0.12);
  overflow-y: auto;
  z-index: 11;
  padding: 20px 24px 60px;
}

.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-head h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -0.02em; }
.panel-head .sub { color: var(--ink-faint); font-size: 13px; }
.close {
  border: 0; background: none; font-size: 22px; line-height: 1;
  color: var(--ink-faint); cursor: pointer; padding: 0 4px;
}
.close:hover { color: var(--ink); }

.panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.facts .f  { display: flex; flex-direction: column; gap: 2px; }
.facts .fk { color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.facts .fv { font-size: 13px; }
.facts .wide { grid-column: 1 / -1; }

.alerts { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.alert-row {
  padding: 8px 11px; border-radius: 6px; font-size: 13px;
  background: var(--warn-bg); color: var(--warn);
  border-left: 3px solid currentColor;
}
.alert-row.high { background: var(--high-bg); color: var(--high); }
.alert-row.info { background: var(--accent-bg); color: var(--accent); }

/* milestones */
.ms { list-style: none; margin: 0; padding: 0; }
.ms li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.ms li:last-child { border-bottom: 0; }
.ms input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.ms .mname { flex: 1; }
.ms li.done .mname { color: var(--ink-faint); text-decoration: line-through; }
.ms li.overdue .mname { color: var(--high); font-weight: 600; }
.ms .mdate { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

/* meeting log */
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.log li:last-child { border-bottom: 0; }
.log .meta { font-size: 11px; color: var(--ink-faint); margin-bottom: 2px; }
.log .body { font-size: 13px; }

.add-note { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.add-note textarea { resize: vertical; min-height: 62px; width: 100%; }
.add-note .row { display: flex; gap: 8px; align-items: center; }

.readonly-note {
  margin-top: 10px; padding: 9px 12px; border-radius: 6px;
  background: var(--line-soft); color: var(--ink-soft); font-size: 12px;
}

/* ============================================================ additions ==
   Regulatory checks, the new statuses and the administration grid.        */

/* status badges for the fuller vocabulary */
.badge.examined  { background: #ede8fb; color: #52389c; }
.badge.reworking { background: var(--high-bg); color: var(--high); }
.badge.lapsed    { background: #eceef2; color: var(--ink-faint); text-decoration: line-through; }
.badge.sz        { background: var(--line-soft); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.badge.risky     { background: var(--high-bg); color: var(--high); }

.warnText { color: var(--high); font-weight: 600; }

/* dashboard pipeline: one step per stage of the degree */
.pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 6px;
}
.step {
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
}
.step .sn {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-faint);
}
.step .sc {
  font-size: 23px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.step .sl { font-size: 11.5px; line-height: 1.3; color: var(--ink-soft); min-height: 2.6em; }
.step .sbar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line-soft);
  overflow: hidden;
  margin-top: 4px;
}
.step .sbar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.step:hover { background: #f7f9fc; }
.step.vacant { opacity: .5; cursor: default; }
.step.vacant .sc { color: var(--ink-faint); }
.step.on { outline: 2px solid var(--accent); background: var(--accent-bg); }

.flag-filter {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; margin-bottom: 12px;
  background: var(--accent-bg); border-radius: 6px;
  font-size: 13px; color: var(--accent);
}

/* inline remove control in the supervision list */
button.linkish {
  font: inherit; font-size: 12px;
  border: 0; background: none; color: var(--ink-faint);
  cursor: pointer; text-decoration: underline; padding: 0 2px;
}
button.linkish:hover { color: var(--high); }

/* administration form */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px 14px;
}
.admin-grid label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-faint);
}
.admin-grid input, .admin-grid select {
  font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink);
}

.ms .badge.role { text-transform: capitalize; min-width: 62px; text-align: center; }

/* ------------------------------------------------------------- settings */

.scrollx { overflow-x: auto; }

/* bare .row -- the settings view uses it outside .add-note */
.row { display: flex; gap: 8px; align-items: center; }

#stepTable input[type="number"], #agreementTable input[type="number"] {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#stepTable select { padding: 5px 8px; }
#stepTable td[data-ex60], #stepTable td[data-ex30] { color: var(--ink-faint); white-space: nowrap; }

/* an individually overridden deadline */
.badge.over { background: var(--warn-bg); color: var(--warn); }
.ms .mdate.mdedit { display: flex; align-items: center; gap: 8px; }
.ms .mdate.mdedit input[type="date"] { padding: 4px 7px; font-size: 12px; }

/* -------------------------------------------------------------- cohorts */

label.inline {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--ink);
}
label.inline input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

#cohortList input[type="date"] { padding: 4px 7px; font-size: 12px; }
#cohortList table.data td { padding: 8px 10px; }
#cohortList input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }

.badge.ext { background: #ede8fb; color: #52389c; }

.muted { color: var(--ink-faint); font-style: italic; }

/* the year-default row and the programme rows that follow it */
table.cohorts tr.defrow td { background: var(--accent-bg); border-bottom: 2px solid var(--line); }
table.cohorts tr.defrow input[type="date"] { border-color: var(--accent); font-weight: 600; }
table.cohorts input.inherited {
  color: var(--ink-faint);
  background: var(--line-soft);
  border-style: dashed;
}
table.cohorts input.inherited:focus { color: var(--ink); background: var(--surface); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-head h2 { margin: 0; }

/* closed intakes, tucked below the open ones */
.previous { margin-top: 4px; }
.previous > button { margin-bottom: 14px; }
.previous .card { opacity: .82; }

.badge.host { background: var(--warn-bg); color: var(--warn); }
tr.retired td { opacity: .55; }
#examinerTable .truncate { max-width: 220px; }

/* ------------------------------------------------------------- sign in */

body.signin-page { display: grid; place-items: center; min-height: 100vh; }
.signin {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px 36px;
  width: min(420px, 92vw);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.signin .mark { width: 44px; height: 44px; font-size: 15px; }
.signin h1 { font-size: 18px; margin: 8px 0 0; letter-spacing: -0.01em; }
.signin .hint { margin: 0; }
.signin .alert-row { width: 100%; text-align: left; }
.signin a.primary {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-weight: 600;
  padding: 10px 18px;
}
.signin a.primary:hover { background: #173d70; color: #fff; }
.signin .foot { margin-top: 6px; font-size: 11.5px; line-height: 1.5; }

.identity a.signout { font-size: 12px; color: var(--ink-faint); text-decoration: none; }
.identity a.signout:hover { color: var(--high); text-decoration: underline; }
.identity .whoami { font-size: 13px; font-weight: 600; }
