:root {
    --bg: #f7f5f1;
    --surface: #ffffff;
    --ink: #191817;
    --muted: #6f6a63;
    --line: #ded8cf;
    --accent: #b79b72;
    --accent-dark: #756044;
    --graphite: #2a2a2a;
    --success: #2e6b4f;
    --danger: #9b2f2f;
    --shadow: 0 12px 30px rgba(30, 26, 20, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.58;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }
.container { width: min(1220px, calc(100% - 32px)); margin: 0 auto; }
.narrow { width: min(840px, calc(100% - 32px)); }

.topbar { background: var(--graphite); color: #fff; font-size: 13px; }
.topbar__inner { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner { display: grid; grid-template-columns: 230px minmax(220px, 1fr) minmax(260px, 410px); gap: 22px; align-items: center; padding: 22px 0; }
.brand img { max-width: 210px; height: auto; }
.brand strong { display: block; font-size: 30px; letter-spacing: 0; }
.brand span { color: var(--muted); font-size: 14px; }
.search, .wide-search { display: flex; min-width: 0; }
.search input, .wide-search input {
    width: 100%;
    border: 1px solid var(--line);
    border-right: 0;
    padding: 12px 14px;
    background: #fff;
}
.search button, .wide-search button, .button, .admin-form button, .login-panel button {
    border: 1px solid var(--graphite);
    background: var(--graphite);
    color: #fff;
    padding: 11px 16px;
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}
.button--primary { background: var(--accent-dark); border-color: var(--accent-dark); }
.header-ad .ad-slot { min-height: 84px; }
.main-nav { border-top: 1px solid var(--line); background: #fff; }
.main-nav__inner { position: relative; }
.main-nav__links { display: flex; gap: 4px; overflow-x: auto; }
.main-nav a { padding: 13px 14px; font-weight: 700; font-size: 14px; text-transform: uppercase; white-space: nowrap; }
.main-nav a:hover { background: #f1ece4; }
.nav-toggle { display: none; width: 100%; border: 0; background: #fff; padding: 13px 0; font-weight: 800; text-align: left; }

.flash { margin: 16px 0; padding: 13px 16px; border: 1px solid #bfd4c8; background: #edf8f1; color: var(--success); border-radius: 6px; }
.flash--error { border-color: #e2b8b8; background: #fff1f1; color: var(--danger); }
.kicker { color: var(--accent-dark); text-transform: uppercase; font-size: 12px; font-weight: 800; margin: 0 0 6px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); margin: 0 0 18px; padding-bottom: 8px; }
.section-head h1, .section-head h2 { margin: 0; font-size: 23px; line-height: 1.15; }
.section-head a { color: var(--accent-dark); font-weight: 700; font-size: 14px; }

.hero-grid, .page-grid, .article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 30px; padding: 28px 0; align-items: start; }
.lead-card { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.lead-card__media { min-height: 360px; background: linear-gradient(135deg, #262626, #c3ad91); display: grid; place-items: center; overflow: hidden; color: #fff; font-weight: 800; }
.lead-card__media img { width: 100%; height: 100%; object-fit: cover; }
.lead-card__body { padding: 28px; align-self: end; }
.lead-card h2 { margin: 8px 0 12px; font-size: 34px; line-height: 1.1; letter-spacing: 0; }
.lead-card p { color: var(--muted); margin: 0; }
.important-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0 28px; }
.important-strip a { background: #fff; border: 1px solid var(--line); padding: 14px; font-weight: 750; min-height: 76px; }

.cards-grid { display: grid; gap: 18px; }
.cards-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.article-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-width: 0; }
.article-card__media { aspect-ratio: 16 / 10; background: #2b2a28; display: grid; place-items: center; color: #fff; font-weight: 800; overflow: hidden; }
.article-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s ease; }
.article-card:hover img { transform: scale(1.03); }
.article-card__body { padding: 14px; }
.article-card h3 { margin: 7px 0 8px; font-size: 18px; line-height: 1.22; }
.article-card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.article-card time { color: var(--muted); font-size: 12px; }
.sponsored-badge { display: inline-block; margin-left: 6px; color: var(--accent-dark); border: 1px solid var(--accent); padding: 2px 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; border-radius: 4px; }

.sidebar { display: grid; gap: 18px; min-width: 0; }
.side-box, .newsletter-box, .author-box, .admin-card, .form-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.side-box h2, .newsletter-box h2, .author-box h2 { margin: 0 0 12px; font-size: 19px; }
.rank-list { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.rank-list li::marker { color: var(--accent-dark); font-weight: 800; }
.newsletter-box p { color: var(--muted); margin-top: 0; }
.newsletter-box form { display: grid; gap: 10px; }
.newsletter-box input[type="email"], .form-panel input, .form-panel textarea {
    width: 100%;
    border: 1px solid var(--line);
    padding: 11px 12px;
    background: #fff;
}
.check { display: flex; gap: 8px; color: var(--muted); font-size: 13px; }
.hp { position: absolute; left: -9999px; }
.ad-slot { min-height: 118px; border: 1px dashed #bfb5a7; background: #f2eee7; color: var(--muted); display: grid; place-items: center; text-align: center; padding: 12px; border-radius: 8px; overflow: hidden; }
.ad-slot img { width: 100%; height: auto; }
.ad-slot small { display: block; font-size: 11px; }
.ad-slot--text a { font-weight: 800; color: var(--accent-dark); }

.band { background: #ebe5dc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 30px 0; margin: 10px 0 28px; }
.topic-section { padding: 24px 0; }
.event-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.event-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 12px; }
.event-card h3 { margin: 4px 0; font-size: 18px; }
.event-card p { margin: 0; color: var(--muted); }
.event-card__status { color: var(--accent-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.event-card__date { font-weight: 800; }

.archive-head { background: var(--surface); border: 1px solid var(--line); padding: 22px; margin-bottom: 20px; border-radius: 8px; }
.archive-head h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.12; }
.archive-head p:last-child { margin-bottom: 0; color: var(--muted); }
.pagination { display: flex; gap: 8px; margin: 24px 0; flex-wrap: wrap; }
.pagination a { border: 1px solid var(--line); background: #fff; min-width: 40px; min-height: 40px; display: grid; place-items: center; border-radius: 4px; }
.pagination .is-active { background: var(--graphite); color: #fff; border-color: var(--graphite); }

.article-view { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 30px; min-width: 0; }
.breadcrumbs { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.article-view h1 { font-size: 42px; line-height: 1.08; margin: 0 0 14px; letter-spacing: 0; }
.lead { font-size: 20px; color: #3c3935; margin: 0 0 16px; }
.article-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 20px; }
.article-figure { margin: 0 0 22px; }
.article-figure img { width: 100%; max-height: 620px; object-fit: cover; border-radius: 8px; }
.article-figure figcaption { color: var(--muted); font-size: 13px; margin-top: 8px; }
.article-content { font-size: 18px; }
.article-content h2 { margin: 30px 0 10px; font-size: 27px; line-height: 1.18; }
.article-content h3 { margin: 22px 0 8px; font-size: 22px; }
.article-content a { color: var(--accent-dark); text-decoration: underline; }
.article-content ul, .article-content ol { padding-left: 24px; }
.partner-box { border-left: 4px solid var(--accent); background: #f5efe6; padding: 12px 14px; margin: 0 0 18px; font-weight: 700; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0; }
.tags a { background: #f0ebe3; border: 1px solid var(--line); padding: 6px 10px; border-radius: 4px; font-size: 14px; }
.event-details { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.event-details dt { font-weight: 800; }
.event-details dd { margin: 0; color: var(--muted); }
.form-panel { display: grid; gap: 14px; }
.form-panel label { display: grid; gap: 6px; font-weight: 700; }

.site-footer { background: #1f1f1e; color: #fff; margin-top: 40px; padding: 36px 0; }
.footer-grid { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 28px; }
.footer-grid h2, .footer-grid h3 { margin-top: 0; }
.footer-grid a { display: block; color: #e9dfd1; margin: 6px 0; }
.source-note { color: #cfc6ba; }

.admin-body { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: #f3f1ed; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; background: #242321; color: #fff; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.admin-brand { font-weight: 900; font-size: 20px; }
.admin-sidebar nav { display: grid; gap: 4px; }
.admin-sidebar a, .admin-sidebar button { color: #fff; background: transparent; border: 0; text-align: left; padding: 10px 8px; border-radius: 4px; cursor: pointer; }
.admin-sidebar a:hover, .admin-sidebar button:hover { background: rgba(255,255,255,.1); }
.admin-main { padding: 28px; min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 30px; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stats-grid--small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-grid div { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.stats-grid span { display: block; color: var(--muted); font-size: 13px; }
.stats-grid strong { font-size: 28px; }
.admin-card { margin-bottom: 18px; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 10px; vertical-align: top; text-align: left; }
.admin-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.actions button, .actions a { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 5px 8px; border-radius: 4px; min-height: 0; }
.admin-filters { display: flex; gap: 10px; margin-bottom: 16px; }
.admin-filters input, .admin-filters select, .admin-form input, .admin-form textarea, .admin-form select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 11px;
    border-radius: 4px;
}
.admin-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--wide { grid-template-columns: 1fr; }
.admin-form label { display: grid; gap: 6px; font-weight: 700; }
.form-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 14px; }
.editor-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-toolbar button { min-height: 34px; padding: 6px 10px; background: #fff; color: var(--ink); border-color: var(--line); }
.editor-area { min-height: 460px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.media-tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-width: 0; }
.media-tile img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; border-radius: 6px; background: #eee; }
.media-tile strong, .media-tile small { display: block; overflow-wrap: anywhere; }

.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 20px; }
.login-panel, .install-panel { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 26px; display: grid; gap: 14px; }
.install-panel { width: min(920px, 100%); }
.login-panel img, .install-panel img { max-width: 220px; margin: 0 auto 8px; }
.login-panel h1, .install-panel h1 { text-align: center; margin: 0 0 8px; }
.login-panel label { display: grid; gap: 6px; font-weight: 700; }
.login-panel input { border: 1px solid var(--line); padding: 11px 12px; }

@media (max-width: 1040px) {
    .site-header__inner { grid-template-columns: 1fr; }
    .header-ad { order: 3; }
    .hero-grid, .page-grid, .article-layout { grid-template-columns: 1fr; }
    .cards-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .container { width: min(100% - 24px, 1220px); }
    .topbar__inner { align-items: flex-start; flex-direction: column; padding: 8px 0; gap: 6px; }
    .site-header__inner { padding: 16px 0; gap: 14px; }
    .brand img { max-width: 180px; }
    .search, .wide-search, .admin-filters { flex-direction: column; }
    .search input, .wide-search input { border-right: 1px solid var(--line); }
    .nav-toggle { display: block; }
    .main-nav__links { display: none; flex-direction: column; overflow: visible; padding-bottom: 10px; }
    .main-nav__links.is-open { display: flex; }
    .lead-card { grid-template-columns: 1fr; }
    .lead-card__media { min-height: 230px; }
    .lead-card h2 { font-size: 28px; }
    .important-strip, .cards-grid--2, .cards-grid--3, .cards-grid--4, .event-grid, .footer-grid { grid-template-columns: 1fr; }
    .article-view { padding: 20px; }
    .article-view h1, .archive-head h1 { font-size: 30px; }
    .article-content { font-size: 16px; }
    .event-details { grid-template-columns: 1fr; }
    .admin-body { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; }
    .admin-sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-main { padding: 18px; }
    .form-grid, .stats-grid, .stats-grid--small, .media-grid { grid-template-columns: 1fr; }
}
