:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f0f5f4;
  --text: #16201f;
  --muted: #66716f;
  --line: #dce3e1;
  --brand: #08746f;
  --brand-dark: #075b58;
  --accent: #b84c20;
  --danger: #b3261e;
  --ok: #247a42;
  --shadow: 0 1px 2px rgba(9, 30, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

a {
  color: var(--brand-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 180px;
}

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}

.nav a,
.nav button,
.button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  min-height: 38px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav a.primary,
.button.primary,
button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.danger,
button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.notice {
  background: #fff8ed;
  border: 1px solid #efd3ac;
  color: #5b3216;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: #eaf7f4;
  border: 1px solid #b8ded7;
  color: #124c49;
}

.grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 20px;
}

.panel-body {
  padding: 18px;
}

.category-list {
  display: flex;
  flex-direction: column;
}

.category-list a {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.category-list a:last-child {
  border-bottom: 0;
}

.category-list a.active {
  background: var(--panel-soft);
  color: var(--brand-dark);
  font-weight: 700;
}

.category-list small {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters input,
.filters select {
  min-height: 40px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 170px;
  resize: vertical;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

.field {
  margin-bottom: 16px;
}

.help {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

.thread-list {
  display: flex;
  flex-direction: column;
}

.thread-item {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.thread-item:last-child {
  border-bottom: 0;
}

.thread-title {
  margin: 0 0 8px;
  font-size: 18px;
}

.thread-title a {
  color: var(--text);
}

.meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-size: 12px;
  color: var(--muted);
  background: #fff;
}

.badge.ok {
  color: var(--ok);
  border-color: #b8dcc5;
  background: #eff9f2;
}

.badge.warn {
  color: var(--accent);
  border-color: #efc8b4;
  background: #fff4ec;
}

.badge.danger {
  color: var(--danger);
  border-color: #efb5b1;
  background: #fff1f0;
}

.post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.thread-page {
  display: grid;
  gap: 18px;
}

.reply {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
  cursor: pointer;
}

button:hover,
.button:hover {
  text-decoration: none;
  border-color: var(--brand);
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
  text-align: left;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
}

.inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form select {
  min-width: 130px;
  width: auto;
}

.empty {
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 40px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .topbar-inner,
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    margin-left: 0;
    width: 100%;
  }

  .nav a,
  .nav button,
  .button {
    flex: 1 1 auto;
  }

  .grid,
  .two-col {
    grid-template-columns: 1fr;
  }
}

