:root {
  --primary: #2f7d4f;
  --primary-dark: #235e3b;
  --bg: #f7f7f6;
  --surface: #ffffff;
  --border: #d9d9d4;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --danger: #b03030;
  --ok: #2f7d4f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary-dark); }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
p { margin: 6px 0 12px; }
.muted { color: var(--muted); }

.topbar {
  background: #1f1f1f;
  color: white;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.topbar a { color: white; text-decoration: none; margin-right: 10px; font-weight: 500; }
.topbar a:hover { text-decoration: underline; }
.topbar .brand { font-weight: 700; margin-right: auto; }
.user-chip { background: #444; padding: 3px 8px; border-radius: 4px; font-size: 12px; }
.topbar nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar nav form button { background: none; border: 1px solid #666; color: white; padding: 3px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; }

.main { max-width: 1200px; margin: 0 auto; padding: 18px 20px 40px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-dark); text-decoration: none; font-size: 14px; font-weight: 500; margin: 0 0 14px; padding: 6px 12px; border-radius: 4px; background: #eef3ef; border: 1px solid #d1e0d4; }
.back-link:hover { background: #dfe9e1; text-decoration: none; }
.back-link::before { content: "← "; font-size: 16px; font-weight: 700; }

form label { display: block; margin: 10px 0; font-weight: 500; }
form input, form textarea, form select {
  width: 100%;
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  margin-top: 3px;
}
form textarea { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; resize: vertical; }
form label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }
form label.checkbox input { width: auto; margin-top: 0; }

button, .button {
  display: inline-block;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font: inherit;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
button.primary, .button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
button.primary:hover, .button.primary:hover { background: var(--primary-dark); }
button.link { background: none; border: none; color: var(--danger); padding: 0 4px; cursor: pointer; }
form.inline { display: inline-block; margin: 0; }
.inline-form { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }

.flash-error { background: #f6d6d6; color: var(--danger); padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
.flash-ok { background: #d6efde; color: var(--ok); padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }
.flash-warn { background: #fdf1c6; color: #7a5d00; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; }

.login-card {
  max-width: 380px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 8px;
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 14px 18px; margin-bottom: 12px; }
.card-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 6px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 18px; }
.data-table th, .data-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table thead th { background: #efefec; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.badge { display: inline-block; padding: 2px 7px; border-radius: 12px; font-size: 11px; font-weight: 600; background: #ddd; }
.badge-draft { background: #eee; color: #555; }
.badge-ready { background: #d6efde; color: #2f7d4f; }
.badge-submitted { background: #cfe0f5; color: #1a4a84; }
.badge-published { background: #e0d4f4; color: #513a8a; }

.toolbar { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.feature-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.feature-row input { margin-top: 0; flex: 1; }

.copyable { position: relative; margin: 6px 0 12px; }
.copyable pre {
  background: #1f1f1f;
  color: #f4f4f4;
  padding: 12px 14px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace;
  max-height: 480px;
  overflow: auto;
}
.copyable .copy-btn { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 4px 10px; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.kv:first-of-type { border-top: none; }
.kv-key { font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 12px; }
.kv-val { min-width: 0; }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } .kv-key { padding-top: 0; } }

details > summary { cursor: pointer; padding: 8px 0; font-weight: 600; color: var(--primary-dark); }
