:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #667085;
  --border: #e4e7ec;
  --accent: #2f5cff;
  --accent-dark: #1e40e0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --max-width: 860px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

header.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}

header.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1000px;
}

.logo {
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.logo span { color: var(--accent); }

.site-tagline {
  color: var(--text-muted);
  font-size: 14px;
}

main { padding: 40px 0 80px; }

.post-list { display: flex; flex-direction: column; gap: 24px; }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16,24,40,0.08);
}

.post-card h2 { margin: 0 0 8px; font-size: 22px; }
.post-card h2 a { color: var(--text); }
.post-card .meta { color: var(--text-muted); font-size: 13px; margin-bottom: 10px; }
.post-card .excerpt { color: var(--text-muted); margin: 0 0 12px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: #d92d20; }
.btn-danger:hover { background: #b02318; }

.post-page article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.post-page h1 { margin-top: 0; font-size: 30px; }
.post-page .meta { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.post-page .cover { width: 100%; border-radius: var(--radius); margin-bottom: 24px; }

.post-content h2 { margin-top: 32px; font-size: 22px; }
.post-content h3 { margin-top: 24px; font-size: 18px; }
.post-content p { margin: 12px 0; }
.post-content img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin: 12px 0; }
.post-content pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; }
.post-content code { background: #eef1f5; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.post-content pre code { background: none; padding: 0; }
.post-content ul, .post-content ol { padding-left: 22px; }
.post-content a { text-decoration: underline; }

.download-box {
  margin-top: 32px;
  padding: 20px;
  background: #f0f4ff;
  border: 1px solid #d3ddff;
  border-radius: var(--radius);
  text-align: center;
}

.back-link { display: inline-block; margin-bottom: 20px; color: var(--text-muted); font-size: 14px; }

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

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Админка ---------- */
.admin-body { background: var(--bg); }
.admin-header {
  background: var(--text);
  color: #fff;
  padding: 14px 0;
}
.admin-header .container { display: flex; justify-content: space-between; align-items: center; max-width: 1100px; }
.admin-header a { color: #fff; }
.admin-header .brand { font-weight: 700; }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }

.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.admin-table th { color: var(--text-muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: none; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-published { background: #dcfce7; color: #166534; }
.status-draft { background: #fef3c7; color: #92400e; }

.login-wrap { max-width: 380px; margin: 80px auto; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group .hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
input[type=text], input[type=password], input[type=url], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

.editor-toolbar { border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: #fafafa; padding: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.editor-toolbar button { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.editor-toolbar button:hover { background: var(--bg); }
#editor { border: 1px solid var(--border); border-radius: 0 0 8px 8px; min-height: 400px; padding: 16px; font-size: 15px; }
#editor:focus { outline: none; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee4e2; color: #b42318; border: 1px solid #fecdca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .post-page article { padding: 20px; }
  .admin-table { display: block; overflow-x: auto; }
}
