:root {
  --ink: #14181f;
  --muted: #5b6472;
  --line: #e3e6ea;
  --bg: #f7f8fa;
  --card: #ffffff;
  --accent: #c8442d;
  --accent-dark: #a3341f;
  /* logo.png's background is opaque pure black, not our --ink navy — this
     matches it exactly so the logo blends into the topbar instead of
     showing a visible box. Kept separate from --ink (used for body text)
     so this stays purely a topbar/branding concern. */
  --topbar-bg: #000000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

.topbar {
  background: var(--topbar-bg);
  color: #fff;
}
/* 3-column grid so the tagline sits at the true horizontal center of the bar,
   independent of how wide the logo or nav happen to be — a flex row with
   space-between can't do that since it only centers when both sides match. */
.topbar .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 20px; }
.brand { justify-self: start; display: flex; align-items: center; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand-logo { height: 48px; width: auto; display: block; }
.tagline { justify-self: center; color: #9aa1ad; font-size: 0.82rem; font-style: italic; line-height: 1; display: inline-flex; align-items: center; }
.topbar nav { justify-self: end; }
@media (max-width: 640px) { .tagline { display: none; } }
.topbar nav a { color: #c9ced8; text-decoration: none; margin-left: 20px; font-size: 0.92rem; }
.topbar nav a:hover { color: #fff; }
.topbar nav a.ask-link { color: #ffb199; font-weight: 600; }

main.wrap { padding: 28px 20px 60px; }

h1 { font-size: 1.6rem; margin: 0 0 18px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }

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

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
th { background: #f0f1f4; font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  background: #eef0f3;
  color: var(--muted);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 0.78rem;
}

.stat-row { display: flex; gap: 14px; margin-bottom: 10px; }
.stat {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.stat-num { font-size: 1.8rem; font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.event-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}
.event-section h2 { margin-top: 0; margin-bottom: 14px; }
.leader-row { margin-bottom: 16px; }
.leader-row:last-child { margin-bottom: 0; }
.leader-row-label {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.leader-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 4px;
}
.leader-card.empty { color: var(--muted); font-size: 0.9rem; }
.leader-name { font-weight: 700; text-decoration: none; }
.leader-name:hover { text-decoration: underline; }
.leader-mark { font-size: 1.3rem; font-weight: 700; margin-top: 2px; }

.event-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 10px 0;
  z-index: 5;
}
.pill {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}
.pill:hover { border-color: var(--accent); color: var(--accent-dark); }

.back-to-top {
  display: inline-block;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}
.back-to-top:hover { color: var(--accent-dark); }

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input[type=text], .search-form select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.95rem; }
.search-form input[type=text] { flex: 1; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--accent-dark); }

.ask-banner {
  background: linear-gradient(135deg, #241c1a, #3a231d);
  color: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.ask-banner strong { display: block; }
.ask-banner .btn { margin-left: auto; }

.ask-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.ask-form input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.cache-tag { background: #e6f4ea; color: #1e7a3d; font-size: 0.7rem; vertical-align: middle; }

.ai-answer {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 18px;
}
.ai-answer h2 { margin-top: 0; }

.alert { padding: 10px 14px; border-radius: 8px; margin-top: 14px; font-size: 0.92rem; }
.alert-error { background: #fdeceb; color: #a3341f; border: 1px solid #f3c9c3; }

.entry-form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.entry-form-wide { max-width: 840px; }
.entry-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.entry-form input, .entry-form select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--ink);
  font-family: inherit;
}

.admin-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-links a { font-weight: 600; }

.import-log { list-style: none; padding: 0; margin: 0; font-size: 0.88rem; font-family: ui-monospace, monospace; }
.import-log li { padding: 3px 0; border-bottom: 1px solid var(--line); }
.import-log li:last-child { border-bottom: none; }
.import-log .log-new { color: var(--accent-dark); font-weight: 600; }
.import-log .log-skip { color: #a3341f; }
.import-log .log-summary { font-weight: 700; margin-top: 6px; font-family: inherit; }
.import-log .log-info { color: var(--muted); }

.footer { color: var(--muted); font-size: 0.82rem; padding: 20px; text-align: center; }
