:root {
  --ink: #1f2933;
  --muted: #616e7c;
  --accent: #0f609b;
  --accent-dark: #0a4a7a;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #d9e2ec;
  --error-bg: #ffe3e3;
  --error-ink: #911111;
  --success-bg: #e3f9e5;
  --success-ink: #1b5e20;
}

* { box-sizing: border-box; }

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

.wrap { max-width: 860px; margin: 0 auto; padding: 0 1rem; }

.site-header {
  background: var(--accent-dark);
  color: #fff;
  padding: 0.75rem 0;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.site-header nav a { color: #cfe3f5; text-decoration: none; margin-left: 1rem; }
.site-header nav a:hover { color: #fff; text-decoration: underline; }

main { padding: 1.5rem 1rem 3rem; }
h1 { margin-top: 0.5rem; }
.lede { color: var(--muted); max-width: 60ch; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  margin: 1rem 0;
}
.narrow-card { max-width: 24rem; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 1rem 0;
  padding: 0.75rem 1rem 1rem;
}
legend { font-weight: 600; padding: 0 0.4rem; }

label { display: block; margin: 0.6rem 0; font-weight: 600; }
.req { color: var(--error-ink); }
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > label { flex: 1 1 12rem; }
.row > label.narrow { flex: 0 1 8rem; }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0.4rem 0 0; }

button, .button-link {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button-link:hover { background: var(--accent-dark); }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin: 1rem 0; }
.alert.error { background: var(--error-bg); color: var(--error-ink); }
.alert.success { background: var(--success-bg); color: var(--success-ink); }

details.card summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}

.post-list, .reply-list { list-style: none; padding: 0; }
.post-item, .reply {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 0.6rem 0;
}
.post-title { font-weight: 700; font-size: 1.05rem; color: var(--accent); text-decoration: none; }
.post-title:hover { text-decoration: underline; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.empty { color: var(--muted); padding: 1rem 0; }

.qr-card { text-align: center; }

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--card); font-size: 0.9rem; }
th, td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; text-align: left; vertical-align: top; }
th { background: #eef3f8; }
.wrap-cell { max-width: 24rem; white-space: pre-wrap; }

.status { padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600; font-size: 0.8rem; }
.status-sent { background: var(--success-bg); color: var(--success-ink); }
.status-pending, .status-no_email { background: #fff3cd; color: #7a5b00; }
.status-failed { background: var(--error-bg); color: var(--error-ink); }

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  padding-bottom: 2rem;
}

@media print {
  .site-header, .site-footer, button { display: none; }
}
