/* ── Reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f6fa;
  --surface:   #ffffff;
  --border:    #dce1e8;
  --text:      #1e2a38;
  --text-muted:#6b7a8d;
  --primary:   #2563eb;
  --primary-hover: #1d4ed8;
  --nav-bg:    #1e2a38;
  --nav-text:  #e2e8f0;
  --accent:    #3b82f6;
  --red:       #ef4444;
  --amber:     #f59e0b;
  --green:     #22c55e;
  --grey:      #94a3b8;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,.08);
}

html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: .6rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 1rem 0 .4rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Navbar ──────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  background: var(--nav-bg);
  padding: 0 1.5rem;
  height: 50px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.navbar a,
.navbar .nav-btn {
  color: var(--nav-text);
  padding: .4rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  transition: background .15s;
  white-space: nowrap;
}
.navbar a:hover,
.navbar .nav-btn:hover {
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* ── Main container ──────────────────────────────── */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Cards / panels ──────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ── Programme accordion rows ────────────────────── */
.prog-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: .5rem;
  overflow: hidden;
}

.prog-header {
  display: flex;
  align-items: center;
  padding: .7rem 1rem;
  cursor: pointer;
  user-select: none;
  gap: .6rem;
  transition: background .12s;
}
.prog-header:hover { background: #f8fafc; }

.prog-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.prog-row.open .prog-arrow { transform: rotate(90deg); }

.prog-name {
  font-weight: 600;
  font-size: .95rem;
  flex: 1;
}
.prog-name a { color: var(--text); }
.prog-name a:hover { color: var(--primary); }

.prog-badge {
  font-size: .75rem;
  color: var(--text-muted);
  padding: .15rem .5rem;
  background: var(--bg);
  border-radius: 10px;
}

.prog-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  border-top: 1px solid transparent;
}
.prog-row.open .prog-body {
  border-top-color: var(--border);
}

.prog-body-inner {
  padding: .6rem 1rem .8rem 2.6rem;
}

.proj-link {
  display: block;
  padding: .3rem 0;
  font-size: .9rem;
}

.no-projects {
  font-size: .85rem;
  color: var(--text-muted);
  padding: .3rem 0;
}

/* ── Tables ──────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: .55rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f8fafc;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-muted);
}
tr:last-child td { border-bottom: none; }

/* ── Forms ───────────────────────────────────────── */
input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-family: inherit;
  font-size: .9rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 400px;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
textarea { min-height: 100px; resize: vertical; max-width: 100%; }

label {
  display: block;
  font-weight: 500;
  font-size: .85rem;
  margin-bottom: .25rem;
  color: var(--text);
}
p > label { margin-bottom: 0; }

.btn, button[type="submit"] {
  display: inline-block;
  padding: .5rem 1.1rem;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background .15s;
}
.btn:hover, button[type="submit"]:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f1f5f9; }

/* ── Action links row ────────────────────────────── */
.action-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .75rem 0;
}
.action-links a {
  padding: .35rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  color: var(--primary);
  transition: background .12s;
}
.action-links a:hover {
  background: #eff6ff;
  text-decoration: none;
}

/* ── RAG badges ──────────────────────────────────── */
.rag { display: inline-block; padding: .15rem .55rem; border-radius: 10px; font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.rag-red   { background: #fef2f2; color: var(--red); }
.rag-amber { background: #fffbeb; color: var(--amber); }
.rag-green { background: #f0fdf4; color: var(--green); }
.rag-grey  { background: #f1f5f9; color: var(--grey); }

/* RAG dot (inline marker next to names) */
.rag-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: .35rem;
  flex-shrink: 0;
}
.rag-dot-red   { background: var(--red); }
.rag-dot-amber { background: var(--amber); }
.rag-dot-green { background: var(--green); }
.rag-dot-grey  { background: var(--grey); }

/* ── Meta info ───────────────────────────────────── */
.meta { font-size: .85rem; color: var(--text-muted); }

/* ── Lists (generic) ─────────────────────────────── */
ul.clean { list-style: none; }
ul.clean li { padding: .3rem 0; }

/* ── Messages (Django) ───────────────────────────── */
.messages {
  list-style: none;
  margin-bottom: 1rem;
}
.messages li {
  padding: .6rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: .4rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.messages .success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.messages .error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.messages .warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  .navbar { padding: 0 .75rem; }
  .main-content { padding: 1rem .75rem 2rem; }
  table { font-size: .8rem; }
  th, td { padding: .4rem .5rem; }
}
