:root {
  --navy: #1B4F8A;
  --orange: #E8862A;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #dde2ea;
  --text: #1a2332;
  --muted: #6b7a90;
  --row-even: #f0f4f9;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: var(--navy);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

header a {
  color: var(--orange);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--orange);
  padding: 4px 12px;
  border-radius: 20px;
  transition: background 0.15s;
}
header a:hover { background: var(--orange); color: #fff; }

/* ── Toolbar ── */
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.toolbar label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 6px;
}

.toolbar input[type="text"],
.toolbar select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}
.toolbar input[type="text"]:focus,
.toolbar select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(27,79,138,0.12);
}
.toolbar input[type="text"] { min-width: 180px; }

/* ── Table container ── */
.table-wrap {
  overflow-x: auto;
  margin: 20px 24px;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  background: var(--surface);
}

/* ── Table ── */
#grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#grid th {
  background: var(--navy);
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}

#grid th:first-child { width: 40px; border-radius: var(--radius) 0 0 0; }
#grid th:last-child  { border-radius: 0 var(--radius) 0 0; }

/* col widths */
#grid th:nth-child(1) { width: 44px; }   /* # */
#grid th:nth-child(2) { width: 120px; }  /* Phase */
#grid th:nth-child(3) { width: auto; }   /* Task — flexible */
#grid th:nth-child(4) { width: 110px; }  /* Owner */
#grid th:nth-child(5) { width: 130px; }  /* Status */
#grid th:nth-child(6) { width: 240px; }  /* Notes */
#grid th:nth-child(7) { width: 160px; }  /* Last update */

#grid td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#grid tbody tr:nth-child(even) td { background: var(--row-even); }
#grid tbody tr:hover td { background: #e8eef6; }

/* seq cell */
#grid td:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

/* phase pill */
#grid td:nth-child(2) {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--navy);
}

/* title */
#grid td:nth-child(3) {
  font-size: 0.88rem;
  word-break: break-word;
}

/* meta */
td.meta {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Inline form controls ── */
#grid select, #grid input.notes {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}
#grid select:hover, #grid input.notes:hover {
  border-color: var(--border);
  background: #fff;
}
#grid select:focus, #grid input.notes:focus {
  border-color: var(--navy);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(27,79,138,0.10);
}

/* ── Status colouring via data-status attribute ── */
select.status[data-status="Not started"]   { color: var(--muted); }
select.status[data-status="In progress"]   { color: #b45309; font-weight: 600; }
select.status[data-status="Blocked"]       { color: #b91c1c; font-weight: 700; }
select.status[data-status="Done"]          { color: #15803d; font-weight: 700; }

/* ── Docs page ── */
.docs-wrap {
  max-width: 860px;
  margin: 32px auto;
  padding: 0 24px;
}

.docs-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.docs-nav a {
  color: var(--navy);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
}
.docs-nav a:hover, .docs-nav a.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.doc-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  line-height: 1.7;
}

.doc-content h1 { font-size: 1.5rem; color: var(--navy); margin-bottom: 16px; border-bottom: 3px solid var(--orange); padding-bottom: 8px; }
.doc-content h2 { font-size: 1.15rem; color: var(--navy); margin: 28px 0 10px; }
.doc-content h3 { font-size: 1rem; color: var(--navy); margin: 20px 0 8px; }
.doc-content h4, .doc-content h5, .doc-content h6 { font-size: 0.9rem; color: var(--navy); margin: 16px 0 6px; font-weight: 700; }
.doc-content p { margin: 8px 0; }
.doc-content ul, .doc-content ol { margin: 8px 0 8px 24px; }
.doc-content li { margin: 4px 0; }
.doc-content code { background: #eef1f6; border-radius: 3px; padding: 1px 5px; font-family: "SF Mono", "Fira Code", Consolas, monospace; font-size: 0.85em; color: #c0392b; }
.doc-content pre { background: #1e2a3a; color: #e2e8f0; border-radius: var(--radius); padding: 16px 20px; overflow-x: auto; margin: 12px 0; }
.doc-content pre code { background: none; color: inherit; padding: 0; font-size: 0.82em; }
.doc-content strong { font-weight: 700; }
.doc-content em { font-style: italic; }
.doc-content blockquote { border-left: 4px solid var(--orange); margin: 12px 0; padding: 8px 16px; background: #fff8f2; color: var(--muted); }

/* Markdown tables */
.doc-content table { width: 100%; border-collapse: collapse; margin: 16px 0; overflow-x: auto; display: block; }
.doc-content thead th { background: var(--navy); color: #fff; padding: 8px 12px; text-align: left; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.doc-content tbody td { padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 0.88rem; vertical-align: top; }
.doc-content tbody tr:nth-child(even) td { background: var(--row-even); }

/* loading state */
.loading { color: var(--muted); padding: 20px 24px; font-style: italic; font-size: 0.9rem; }
