:root {
  --bg: #14161a;
  --surface: #1d2026;
  --surface-alt: #262a32;
  --border: #33383f;
  --text: #e6e8eb;
  --text-dim: #9aa1ab;
  --accent: #5b8def;
  --major: #e2574c;
  --minor: #e2a13c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a { color: var(--accent); }

header.topbar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

header.topbar .brand { font-weight: 700; margin-right: auto; }
header.topbar nav a { margin-right: 1rem; color: var(--text-dim); text-decoration: none; }
header.topbar nav a:hover, header.topbar nav a.active { color: var(--text); }
header.topbar .role-badge {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text-dim);
}

main { max-width: 900px; margin: 0 auto; padding: 1.25rem; }

.flash { padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 0.75rem; }
.flash.info { background: #1e3a5f; color: #cfe3ff; }
.flash.error { background: #4a1f1f; color: #ffd6d2; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

button, input[type=submit] {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.9rem;
}
button.secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: 0.5; cursor: default; }

input, select, textarea {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.field { margin-bottom: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
label { font-size: 0.8rem; color: var(--text-dim); }

.badge { font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px; }
.badge.major { background: var(--major); color: white; }
.badge.minor { background: var(--minor); color: #2a1e00; }

/* Timeline */
#timeline-feed { display: flex; flex-direction: column; gap: 0.15rem; }

.tl-row { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.3rem 0.6rem; border-radius: 6px; }
.tl-row.message { background: var(--surface); }
.tl-row.message.linked { border-left: 3px solid var(--accent); }
.tl-row .tl-meta { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; min-width: 3.5rem; }
.tl-row .tl-meta ul { padding: 0; }
.tl-row .tl-body { padding-left: 16px; flex: 1; white-space: normal; word-break: break-word; }
.tl-row .tl-sender { font-weight: 600; margin-right: 0.4rem; }

.tl-date-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  padding: 0.4rem 0.2rem 0.2rem;
  margin-top: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.tl-date-header:first-child { margin-top: 0; }

.tl-event { border-radius: 6px; padding: 0.6rem 0.8rem; font-weight: 600; }
.tl-event.major { background: rgba(226, 87, 76, 0.15); border: 1px solid var(--major); }
.tl-event.minor { background: rgba(226, 161, 60, 0.15); border: 1px solid var(--minor); }
.tl-event a { color: inherit; text-decoration: none; }

#associate-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.75rem;
}

.sentinel { text-align: center; color: var(--text-dim); padding: 1rem; font-size: 0.85rem; }

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.evidence-grid .card { margin-bottom: 0; }
