:root {
  --bg: #f6f1e9;
  --fg: #3b2f26;
  --muted: #857568;
  --accent: #8b5e34;
  --accent-soft: #f1e8dc;
  --card: #fffdf8;
  --border: #e2d8c8;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
  font-size: 16px;
}

img { max-width: 100%; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 800; font-size: 1.05rem; color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
.site-header nav { display: flex; align-items: center; gap: 20px; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500; }
.site-header nav a:hover { color: var(--fg); }
.site-header nav a.nav-channel { color: var(--accent); font-weight: 700; }
.site-header nav a.nav-channel:hover { color: var(--fg); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 8px; text-align: center; }
.hero h1 { font-size: 2.1rem; margin: 0 0 10px; line-height: 1.2; letter-spacing: -.02em; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 620px; font-size: 1.05rem; }

/* ---------- article grid ---------- */
.articles { padding: 32px 0 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.08); transform: translateY(-2px); border-color: #cdbfa9; }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-img { width: 100%; height: 220px; object-fit: cover; display: block; background: #ece2d2; }
.card-body { padding: 18px 20px 22px; }
.card-date { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.card-title { font-size: 1.15rem; margin: 8px 0 8px; line-height: 1.35; letter-spacing: -.01em; }
.card-title:hover { color: var(--accent); }
.card-excerpt { margin: 0; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 48px; flex-wrap: wrap; }
.page-link { color: var(--fg); text-decoration: none; font-weight: 600; min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; transition: border-color .15s; }
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.current { background: var(--fg); color: #fff; border-color: var(--fg); }
.page-info { color: var(--muted); font-size: .9rem; }

/* ---------- article page ---------- */
.article { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px 36px; margin: 32px 0; }
.breadcrumbs { margin-bottom: 16px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.breadcrumbs a:hover { color: var(--accent); }
.article-title { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.02em; }
.article-date { color: var(--muted); font-size: .9rem; }
.article-img { width: 100%; max-height: 520px; object-fit: cover; border-radius: var(--radius); margin: 20px 0; }
.article-body { font-size: 1.06rem; color: #3b2f26; }
.article-body h2 { font-size: 1.45rem; margin: 32px 0 12px; letter-spacing: -.01em; }
.article-body h3 { font-size: 1.2rem; margin: 26px 0 10px; }
.article-body p { margin: 14px 0; }
.article-body ul, .article-body ol { padding-left: 24px; }
.article-body li { margin: 6px 0; }
.article-body blockquote { margin: 20px 0; padding: 2px 20px; border-left: 3px solid var(--accent); color: var(--muted); }
.article-body a { color: var(--accent); }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
.article-body code { background: #f0e8db; padding: 2px 6px; border-radius: 5px; font-size: .9em; }

/* ---------- related ---------- */
.related { margin: 8px 0 36px; }
.related h2 { font-size: 1.25rem; margin: 0 0 16px; letter-spacing: -.01em; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.related-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.related-card:hover { border-color: #cdbfa9; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.related-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.related-title { padding: 12px 14px; font-weight: 600; font-size: .92rem; line-height: 1.4; }
.related-title:hover { color: var(--accent); }

/* ---------- CTA ---------- */
.cta { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; margin-bottom: 48px; text-align: center; }
.cta h3 { margin: 0 0 8px; font-size: 1.3rem; letter-spacing: -.01em; }
.cta p { margin: 0 auto 20px; color: var(--muted); max-width: 480px; }
.cta-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.cta-links a { display: inline-block; background: var(--fg); color: #fff; padding: 11px 22px; border-radius: 9px; font-weight: 600; font-size: .92rem; text-decoration: none; transition: opacity .15s; }
.cta-links a:hover { opacity: .85; }
.cta-links a:last-child { background: #fff; color: var(--fg); border: 1px solid var(--border); }
.cta-links a:last-child:hover { border-color: var(--fg); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 36px; color: var(--muted); font-size: .9rem; text-align: center; }

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

/* ---------- admin ---------- */
.admin-login { max-width: 380px; margin: 80px auto; padding: 32px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-login h1 { font-size: 1.3rem; margin: 0 0 20px; }
.admin-login input { width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.admin-login button { width: 100%; padding: 11px; background: var(--fg); color: #fff; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; }
.error { color: #a8432e; }

.admin-top { display: flex; align-items: center; gap: 16px; padding: 28px 0 12px; }
.admin-top h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; }
.admin-top a { color: var(--muted); text-decoration: none; font-size: .9rem; }
.admin-top a:hover { color: var(--fg); }
.inline { display: inline; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 0; }
.link-btn:hover { color: var(--fg); }

.admin h2 { font-size: 1.1rem; margin: 28px 0 10px; }

.admin-wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }
.tbl-scroll { overflow-x: auto; margin: 8px 0 28px; }
.tbl-scroll .tbl { min-width: 640px; }

.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tbl tr:hover td { background: #faf5ec; }
.tbl .col-thumb { width: 90px; padding-right: 4px; }
.tbl .col-actions { white-space: nowrap; }
.badge-short { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 5px; background: #f1e8dc; color: #8b5e34; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.hint { color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }

/* ---------- табы ---------- */
.tabs { display: flex; gap: 8px; margin: 16px 0 14px; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border: 1px solid transparent; border-bottom: none; border-radius: 10px 10px 0 0; color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 600; transition: color .12s, background .12s; }
.tab:hover { color: var(--fg); background: var(--card); }
.tab.active { color: var(--fg); background: var(--card); border-color: var(--border); margin-bottom: -1px; }
.tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e8e0d3; color: #8b5e34; font-size: .78rem; font-weight: 700; }
.tab.active .tab-count { background: var(--fg); color: #fff; }

/* ---------- карточки постов ---------- */
.posts-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.post-card { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: border-color .12s, box-shadow .12s; }
.post-card:hover { border-color: #d0c5b2; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.pc-site { background: #f2f8f2; border-color: #d6e6d6; }
.pc-skip { background: #faf9f7; }
.post-card .thumb { width: 72px; height: 72px; flex-shrink: 0; border-radius: 8px; }

.pc-main { flex: 1; min-width: 0; }
.pc-caption { font-size: .9rem; line-height: 1.45; color: var(--fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; font-size: .76rem; color: var(--muted); }
.pc-id { font-weight: 700; color: var(--fg); }
.pc-channel { background: #f1ece4; padding: 1px 8px; border-radius: 999px; }
.pc-date { color: var(--muted); }
.pc-short { color: #a8432e; font-weight: 600; }

.pc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.st { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.st-will { background: #d8ecd8; color: #2f6b2f; }
.st-skip { background: #e9e7e3; color: #857568; }
.st-site { background: #e3e9f7; color: #3d5a8f; }
.pc-sched { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.pc-done { font-size: .78rem; color: #2f6b2f; font-weight: 600; white-space: nowrap; }

.pc-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; background: #e2d8c8; }

.btn { display: inline-block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--fg); font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: border-color .12s, background .12s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--fg); color: #fff; border-color: var(--fg); }
.btn.primary:hover { opacity: .85; color: #fff; }
.btn.danger { color: #a8432e; }
.btn.danger:hover { border-color: #a8432e; background: #fdf3f0; }

.editor { margin-top: 28px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.editor h2 { margin: 0 0 16px; font-size: 1.2rem; }
.editor label { display: block; margin-bottom: 14px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.editor label.chk { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--fg); }
.editor input, .editor textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: .92rem; background: #fff; }
.editor input:focus, .editor textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.msg { margin-top: 12px; color: var(--accent); font-weight: 600; }

@media (max-width: 640px) {
  .articles { grid-template-columns: 1fr; }
  .article { padding: 22px 20px; }
  .article-title { font-size: 1.6rem; }
  .hero { padding-top: 36px; }
  .hero h1 { font-size: 1.7rem; }
  .cta { padding: 24px 20px; }
  .post-card { flex-wrap: wrap; }
  .pc-side { flex-direction: row; align-items: center; width: 100%; justify-content: flex-start; }
  .pc-actions { flex-direction: row; width: 100%; }
}
