:root {
  --blue: #0d476a;
  --teal: #108a81;
  --mint: #2ed5ac;
  --amber: #ffb020;
  --bg: #f4f7f8;
  --card: #ffffff;
  --text: #1c2b33;
  --muted: #6b8089;
  --border: #dfe8ea;
  --danger: #d64545;
  --ok: #1f9d6b;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.55;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: linear-gradient(90deg, var(--blue), var(--teal));
  color: #fff; padding: 14px 24px; display: flex; justify-content: space-between;
  align-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.topbar .logo { color: #fff; font-weight: 700; font-size: 20px; }
.topbar .logo span { font-weight: 400; opacity: .85; }
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar .user { opacity: .95; font-size: 14px; }

.container { max-width: 920px; margin: 28px auto; padding: 0 18px; }
.footer { text-align: center; color: var(--muted); padding: 30px; font-size: 13px; }

.btn, button.btn {
  display: inline-block; background: var(--teal); color: #fff; border: none;
  padding: 11px 22px; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: .15s; text-decoration: none;
}
.btn:hover { background: var(--blue); text-decoration: none; }
.btn-amber { background: var(--amber); color: #3a2000; }
.btn-amber:hover { background: #e89e10; }
.btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.5); padding: 7px 14px;
  border-radius: 8px; font-size: 14px; }
.btn-ghost:hover { background: rgba(255,255,255,.15); text-decoration: none; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.flash { padding: 13px 18px; border-radius: 10px; margin-bottom: 16px; font-size: 15px; }
.flash-success { background: #e3f6ec; color: #12643f; border: 1px solid #b7e4cc; }
.flash-error { background: #fbe6e6; color: #8f2020; border: 1px solid #f0c0c0; }

/* Login */
.login-wrap { max-width: 380px; margin: 8vh auto; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; box-shadow: 0 4px 20px rgba(13,71,106,.06);
}
.card h1 { margin-top: 0; }

/* Forms */
label { display: block; font-weight: 600; margin: 16px 0 6px; font-size: 14px; }
label .req { color: var(--danger); }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
input[type=text], input[type=password], input[type=date], input[type=url], textarea, select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(46,213,172,.18); }
textarea { min-height: 90px; resize: vertical; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-grid label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400;
  background: #eef4f5; padding: 7px 12px; border-radius: 20px; margin: 0; cursor: pointer; font-size: 13.5px; }
.cat-grid input { width: auto; }
.cat-grid label:has(input:checked) { background: var(--mint); color: #063; font-weight: 600; }

/* Template cards */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 16px; }
.tpl-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  text-decoration: none; color: var(--text); transition: .15s; display: block;
}
.tpl-card:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(16,138,129,.12);
  transform: translateY(-2px); text-decoration: none; }
.tpl-card .icon { font-size: 32px; }
.tpl-card h3 { margin: 8px 0 4px; font-size: 17px; }
.tpl-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* Post list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--border); }
.post-list li:hover { background: #f0f6f7; }
.post-list .meta { color: var(--muted); font-size: 12.5px; }

.section { background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 24px; margin-bottom: 22px; }
.section h2 { margin-top: 0; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 200px; }
.faq-item { border: 1px dashed var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.muted { color: var(--muted); }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
pre.preview { background: #0f2733; color: #d7ecec; padding: 18px; border-radius: 12px;
  overflow: auto; font-size: 12.5px; max-height: 480px; white-space: pre-wrap; }
.badge { display: inline-block; background: var(--mint); color: #063; padding: 3px 10px;
  border-radius: 12px; font-size: 12px; font-weight: 600; }
.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.check-row label { margin: 0; font-weight: 600; }
