:root {
  color-scheme: light;
  --paper: #efe6d8;
  --card: #fffdf8;
  --ink: #221c16;
  --muted: #6d6256;
  --line: #ddd1c0;
  --accent: #8d3b16;
  --accent-ink: #fff8f3;
  --good: #1d6b43;
  --warn: #8a5a00;
  --bad: #8e2f2f;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, #f7f1e6, transparent 36%),
    var(--paper);
  color: var(--ink);
  font: 16px/1.45 "Segoe UI", "Liberation Sans", system-ui, sans-serif;
}

header, nav, main { padding-left: 24px; padding-right: 24px; }

header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding-top: 22px;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.eyebrow, .lede, #run-status, #section-lead {
  margin: 0;
  color: var(--muted);
}

.lede { max-width: 62ch; margin-top: 6px; }

.header-actions { text-align: right; }

.row, .toolbar, .topic-head, .source-actions, .days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.header-actions .row { justify-content: flex-end; margin-top: 8px; }

.session-row { margin-top: 0; }

#who { color: var(--muted); font-size: 14px; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 22px 18px;
}

.login-card h1 { text-align: center; font-size: 30px; }

.login-card .lede { margin: 8px auto 14px; text-align: center; }

.login-card form { display: grid; gap: 12px; }

#login-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--bad);
  background: #fff;
  border: 1px solid #e4b4b4;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 16px;
  padding-bottom: 8px;
}

main { padding-bottom: 48px; }

button, .button, select, input {
  font: inherit;
}

button, .button {
  border: 1px solid #c9b8a4;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .button:hover { border-color: var(--accent); }

button.primary, #search-all, button[type="submit"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

button.danger { color: var(--bad); }

button:disabled { opacity: 0.55; cursor: not-allowed; }

.tab.is-active {
  background: var(--ink);
  color: #f6f0e6;
  border-color: var(--ink);
}

form#topic-form, .topic, .edit-form, .link-form {
  display: grid;
  gap: 10px;
}

form#topic-form {
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr) auto;
  align-items: end;
  margin: 12px 0;
}

label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
}

.topic {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 12px;
  margin-bottom: 12px;
}

.topic h2 {
  margin: 0;
  font-size: 20px;
  font-family: Georgia, "Times New Roman", serif;
}

.meta { color: var(--muted); font-size: 14px; }

.topic-tools { margin-left: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 8px 6px;
  border-top: 1px solid var(--line);
}

th { color: var(--muted); font-size: 13px; font-weight: 600; }

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

.snippet { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.kind {
  display: inline-block;
  border-radius: 999px;
  background: #f3eadf;
  padding: 2px 8px;
  font-size: 13px;
}

.empty, #notice {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed var(--line);
}

#notice.is-error { color: var(--bad); border-color: #e4b4b4; }

pre {
  white-space: pre-wrap;
  background: #241e18;
  color: #f4ecdf;
  border-radius: 16px;
  padding: 16px;
  min-height: 240px;
  overflow: auto;
}

.days button.is-active { background: var(--ink); color: white; border-color: var(--ink); }

.check { display: flex; gap: 6px; align-items: center; color: var(--ink); }

@media (max-width: 800px) {
  header, form#topic-form { display: grid; grid-template-columns: 1fr; }
  .header-actions, .header-actions .row { text-align: left; justify-content: flex-start; }
  header, nav, main { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 28px; }
}
