:root {
  --bg: #f5f7fa; --card: #ffffff; --ink: #1b2430; --muted: #5b6776; --line: #d9e0e8;
  --brand: #1f4e79; --late: #b42318; --ok: #1a7f37; --warn: #9a6700; --conf: #6f2da8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
header.top { background: var(--brand); color: #fff; padding: 8px 16px;
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
header.top a { color: #fff; }
.brand { font-weight: 700; }
nav { display: flex; flex-wrap: wrap; gap: 4px 12px; flex: 1 1 auto; }
nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
nav a.on { border-bottom-color: #fff; font-weight: 600; }
.who { font-size: 14px; }
main { max-width: 960px; margin: 0 auto; padding: 12px 16px 48px; }
h1 { font-size: 22px; margin: 12px 0 6px; overflow-wrap: anywhere; }
h2 { font-size: 18px; margin: 18px 0 6px; }
h3 { font-size: 16px; margin: 14px 0 6px; }
.small { font-size: 14px; color: var(--muted); }
.id { font-family: Consolas, Menlo, monospace; font-size: 13px; color: var(--muted); }
.ref { font-family: Consolas, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.card.narrow { max-width: 420px; margin: 24px auto; }
.flash { padding: 8px 12px; border-radius: 6px; background: #e6f4ea; border: 1px solid #b7dfc2; }
.flash.error { background: #fdecea; border-color: #f5c2bd; }
ul.list { list-style: none; margin: 0; padding: 0; }
li.row { background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0; }
li.row.late { border-left: 4px solid var(--late); }
li.row.st-done, li.row.st-cancelled { opacity: .7; }
li.row .title { display: block; font-weight: 600; text-decoration: none; color: var(--ink); overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--muted); margin-top: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px;
  background: #e8edf3; color: var(--ink); }
.badge.st-open { background: #e3eefc; } .badge.st-in_progress { background: #fff4d6; }
.badge.st-blocked { background: #fde2e1; } .badge.st-done { background: #dcf3e3; }
.badge.st-cancelled { background: #ececec; } .badge.conf { background: #efe3fa; color: var(--conf); }
.due.late, .flag.late { color: var(--late); font-weight: 600; }
.flag { font-size: 13px; padding: 1px 8px; border-radius: 10px; background: #fff4d6; color: var(--warn); }
.flag.late { background: #fdecea; }
.flag.niq { background: #e3eefc; color: var(--brand); }
details.project { background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; padding: 8px 12px; }
details.project summary { cursor: pointer; list-style-position: outside; }
details.project .pname { font-weight: 600; overflow-wrap: anywhere; }
details.project ul.list li.row { border-color: #e6ebf0; }
dl.facts { display: grid; grid-template-columns: 9.5em 1fr; gap: 6px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
dl.facts dt { color: var(--muted); font-size: 14px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
dd.notes { white-space: pre-wrap; }
form.stack { display: flex; flex-direction: column; gap: 10px; }
form.stack label, .pair label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.pair { display: flex; flex-wrap: wrap; gap: 10px; }
.pair label { flex: 1 1 140px; }
form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
form.inline label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
input, select, textarea, button { font: inherit; font-size: 16px; }
input, select, textarea { padding: 6px 8px; border: 1px solid #b8c2cc; border-radius: 6px; background: #fff; max-width: 100%; }
textarea { width: 100%; }
button, .button { background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px;
  cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary { background: #e8edf3; color: var(--ink); }
form.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
form.quick select, form.quick input { flex: 1 1 130px; }
form.quick .result { font-size: 13px; color: var(--ok); flex-basis: 100%; }
form.quick .result.error { color: var(--late); }
.summary { display: flex; flex-wrap: wrap; gap: 6px 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.toggle { display: block; margin: 10px 0; }
body.flagged-only li.row:not(.flagged) { display: none; }
ol.history { list-style: none; padding: 0; margin: 0; }
ol.history li { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; overflow-wrap: anywhere; }
ol.history .when { color: var(--muted); font-family: Consolas, Menlo, monospace; font-size: 12px; }
.old { text-decoration: line-through; color: var(--muted); }
@media (max-width: 480px) {
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dt { margin-top: 6px; }
  header.top { padding: 8px 12px; }
  main { padding: 8px 12px 40px; }
}
