/* Plain, dependency-free styles. Mobile first; tables become stacked rows on phones. */
:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1c2430;
  --muted: #5b6676;
  --line: #d9dee6;
  --accent: #1d5fbf;
  --danger: #b3261e;
  --danger-bg: #fdecea;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 0 16px 32px;
  max-width: 1100px;
  margin-inline: auto;
  overflow-wrap: anywhere;
}
h1 { font-size: 1.5rem; margin: 1rem 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
a { color: var(--accent); }

nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-weight: 600; }
nav form { margin: 0; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.messages { list-style: none; padding: 0; margin: 12px 0; }
.messages li { background: #e8f1fd; border: 1px solid #b9d3f5; border-radius: 6px; padding: 10px 12px; margin-bottom: 6px; }

button, input[type=submit] {
  min-height: 44px; padding: 0 16px; font: inherit; font-weight: 600;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; cursor: pointer;
}
nav button { background: transparent; color: var(--accent); border: 1px solid var(--line); }
input, select, textarea {
  font: inherit; width: 100%; max-width: 32rem; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text);
}
textarea { min-height: 7rem; }
input[type=file] { border: 0; padding-left: 0; }
input[type=checkbox] { width: auto; min-height: 0; }
form p { margin: 0 0 12px; }
main form { margin: 12px 0; }
li form { display: inline; }
form label { display: block; font-weight: 600; margin-bottom: 4px; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 4px 0; }
.helptext { color: var(--muted); font-size: .9rem; }

dl { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
dt { color: var(--muted); font-size: .85rem; margin-top: 8px; }
dt:first-child { margin-top: 0; }
dd { margin: 0; }

ul { padding-left: 1.2rem; }
li { margin-bottom: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef1f5; font-size: .9rem; }

/* Overdue is marked with text and a red accent, never colour alone. */
strong.overdue, tr.overdue strong { color: var(--danger); }
strong.overdue { background: var(--danger-bg); border: 1px solid var(--danger); border-radius: 4px; padding: 0 6px; font-size: .9rem; }
.overdue-flag { color: var(--danger); font-weight: 700; }

@media (max-width: 700px) {
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  table { border: 0; background: transparent; }
  thead { position: absolute; left: -9999px; }
  tr { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 0; }
  td { border: 0; padding: 4px 12px; display: flex; gap: 8px; justify-content: space-between; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: 0 0 40%; }
  td[data-label=""]::before, td:not([data-label])::before { content: none; }
  td:first-child { font-weight: 600; text-align: left; justify-content: flex-start; }
  td form, td button { width: 100%; }
  button, input[type=submit] { width: 100%; }
  nav button { width: auto; }
  .nav-user { flex: 1 1 100%; justify-content: space-between; }
  li form { display: block; margin-top: 6px; }
  input, select, textarea { max-width: 100%; }
}
