:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --ink: #121211;
    --muted: #6f6c66;
    --line: rgba(18, 18, 17, 0.1);
    --accent: #b53428;
    --accent-soft: #f3e8e6;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --wrap-pad: clamp(16px, 4vw, 20px);
    --header-h: 64px;
    --touch: 44px;
    --bp-nav: 1100px;
    --bp-wide: 1280px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

body.nav-open {
    overflow: hidden;
}

body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(18, 18, 17, 0.36);
    z-index: 98;
    pointer-events: none;
}

body.nav-open .foot {
    pointer-events: none;
}

main { flex: 1; min-width: 0; }

::selection {
    background: var(--accent-soft);
    color: var(--ink);
}

img, svg, video { max-width: 100%; height: auto; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.wrap {
    width: min(1080px, 100%);
    margin: 0 auto;
    padding-inline: max(var(--wrap-pad), env(safe-area-inset-left), env(safe-area-inset-right));
}

/* ——— Header ——— */
.top {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--line);
}

.top-bg {
    position: absolute;
    inset: 0;
    background: rgba(246, 245, 242, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
}

.nav {
    position: relative;
    z-index: 1;
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 22px;
    letter-spacing: -0.02em;
    text-decoration: none;
    flex-shrink: 0;
}

.brand b { color: var(--accent); font-weight: 600; }

.nav-toggle {
    display: none;
    margin-left: auto;
    width: var(--touch);
    height: var(--touch);
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 2px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.top.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.top.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
}

.top.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-panel {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 20px;
    flex: 1;
    min-width: 0;
}

.nav-links a,
.nav-user a:not(.btn) {
    text-decoration: none;
    font-size: 15px;
    color: #3a3834;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-user a:not(.btn):hover { color: var(--ink); }

.nav-links a.is-active,
.nav-user a.is-active:not(.btn) {
    color: var(--ink);
    font-weight: 500;
}

.nav-links a.is-active {
    box-shadow: inset 0 -2px 0 var(--accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-user form { margin: 0; }

.nav a.btn { color: #fff; text-decoration: none; }
.nav a.btn.light { color: var(--ink); }

/* ——— Typography ——— */
.hero { padding: clamp(28px, 5vw, 48px) 0 8px; }

.hero h1 {
    font-family: var(--serif);
    font-size: clamp(30px, 6vw, 56px);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin: 0 0 14px;
    text-wrap: balance;
}

.hero h1::after {
    content: "";
    display: block;
    width: 40px;
    height: 3px;
    background: var(--accent);
    margin-top: 16px;
    border-radius: 1px;
}

.hero p {
    font-size: clamp(16px, 2.5vw, 18px);
    color: var(--muted);
    max-width: 640px;
    margin: 0;
    line-height: 1.5;
}

h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.muted { color: var(--muted); font-size: 15px; }
.meta {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.meta a { text-decoration: none; }
.meta a:hover { text-decoration: underline; }

.content-narrow { max-width: 760px; }
.form-narrow { max-width: 480px; }

.stack-gap { display: grid; gap: 28px; }

.row-item--stack {
    flex-direction: column;
    align-items: flex-start;
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.h-reset { margin-top: 0; }

.page-title {
    font-family: var(--serif);
}

.page-form {
    margin-top: 8px;
}

.side-block {
    min-width: 0;
}

.side-block-aside {
    margin-top: 8px;
}

.side-block p:last-child {
    margin-bottom: 0;
}

.empty-state {
    padding: 48px 0;
    text-align: center;
    border-top: 1px solid var(--line);
}

.empty-state--compact {
    padding: 32px 0;
}

.empty-state p {
    margin: 0 auto 20px;
    max-width: 360px;
}

.empty-state .btn {
    margin: 0 auto;
}

/* ——— Layout ——— */
.grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: clamp(24px, 4vw, 48px);
    margin-top: 32px;
    padding-bottom: clamp(32px, 5vw, 48px);
}

.stack { display: grid; gap: 0; min-width: 0; }

/* ——— Blocks ——— */
.block { padding: 28px 0; }
.block--pad { padding: 28px; background: var(--surface); }
.block + .block,
.post + .post { border-top: 1px solid var(--line); }

.side {
    padding: 0;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    min-width: 0;
}

.side h3 { margin: 0 0 10px; font-size: 17px; }
.side p { margin: 0 0 16px; }
.side .divider { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.side-cards > h3 + p,
.side-cards > .side-block {
    margin-bottom: 0;
}

.admin-user-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 0;
}

.admin-user-row + .admin-user-row,
.admin-lead + .admin-lead,
.admin-user-row:first-child {
    margin-top: 0;
}

.admin-lead {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

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

.section-gap {
    margin-top: 18px;
}

.section-title-lg {
    margin-top: 40px;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    white-space: nowrap;
}

.report-actions form {
    display: inline-flex;
}

.card {
    background: transparent;
    border: 0;
    border-radius: 0;
}

.card.form { padding: 28px 0; }
.card.side { padding: 0; position: sticky; top: calc(var(--header-h) + 24px); }

/* ——— Forms ——— */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field--tight { margin-bottom: 0; }
.field label { font-size: 14px; color: var(--muted); }

input, select, textarea, .btn, button, .chip {
    font: inherit;
    font-family: var(--sans);
}

input, select, textarea {
    width: 100%;
    max-width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    border-radius: 0;
    padding: 12px 0;
    color: var(--ink);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-bottom-color: var(--ink);
}

textarea { min-height: 110px; resize: vertical; }

.search-panel {
    padding: 20px 0 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

.search-panel input {
    font-size: 17px;
    padding: 14px 0;
}

.search-panel input::placeholder {
    color: rgba(111, 108, 102, 0.72);
}

.search-hint {
    padding: 8px 0;
}

.feed-main,
.feed-toolbar {
    min-width: 0;
}

.feed-toolbar {
    overflow: hidden;
}

.tabs-cats {
    padding: 16px 0 8px;
    margin-top: 0;
}

.tabs-sort {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .tabs-cats {
        flex-wrap: wrap;
        overflow-x: visible;
        margin-inline: 0;
        padding-inline: 0;
        mask-image: none;
        -webkit-mask-image: none;
    }
}

/* ——— Buttons ——— */
.btn, button[type="submit"]:not(.reaction):not(.chip):not(.nav-toggle) {
    border: 0;
    background: var(--ink);
    color: #fff;
    border-radius: 2px;
    padding: 11px 18px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    min-height: var(--touch);
    line-height: 1.2;
}

.btn:hover, button[type="submit"]:not(.reaction):not(.chip):hover { opacity: 0.88; }

.btn.light, button.btn.light {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}

.btn.red, button.btn.red { background: var(--accent); }

.btn:focus-visible,
.chip:focus-visible,
.reaction:focus-visible,
.nav-toggle:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ——— Chips & tabs ——— */
.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 14px 0;
    align-items: center;
}

.tabs-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
    margin-inline: calc(var(--wrap-pad) * -1);
    padding-inline: var(--wrap-pad);
    scroll-padding-inline: var(--wrap-pad);
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
}

.tabs-scroll::-webkit-scrollbar { display: none; }

.chip {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 2px;
    padding: 7px 12px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

.chip:hover { color: var(--ink); background: rgba(18, 18, 17, 0.04); }
.chip.active { background: var(--ink); color: #fff; }

/* ——— Posts ——— */
.post {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: clamp(16px, 3vw, 24px);
    padding: clamp(20px, 3vw, 28px) 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    min-width: 0;
}

.post h2, .post .post-title {
    font-family: var(--serif);
    font-size: clamp(20px, 3vw, 22px);
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-wrap: pretty;
}

.post .post-title { font-size: clamp(24px, 4vw, 28px); }
.post h2 a, .post .post-title a { text-decoration: none; }
.post h2 a:hover, .post .post-title a:hover { color: var(--accent); }

.desc {
    color: #3d3a35;
    line-height: 1.5;
    margin: 0;
    overflow-wrap: anywhere;
}

.meter { text-align: left; padding: 0; border: 0; }

.meter-note {
    margin-top: 6px;
    font-size: 13px;
}

.score {
    font-family: var(--serif);
    font-size: clamp(28px, 5vw, 32px);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
}

.label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 0; }
.tags .chip { font-size: 13px; padding: 5px 10px; background: rgba(18, 18, 17, 0.04); }

.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

@media (max-width: 520px) {
    .reactions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .reactions form {
        min-width: 0;
    }

    .reaction {
        width: 100%;
        justify-content: center;
        min-height: var(--touch);
    }
}

.reaction {
    background: rgba(18, 18, 17, 0.04);
    color: var(--ink);
    border: 0;
    border-radius: 2px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    min-height: 36px;
}

.reaction:hover { background: rgba(18, 18, 17, 0.08); }

.reactions form { margin: 0; }

/* ——— Comments ——— */
.comment { padding: 18px 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment p { margin: 6px 0 0; overflow-wrap: anywhere; }

/* ——— Tables ——— */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 8px 0;
    position: relative;
}

.table-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(90deg, transparent, var(--bg));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-wrap.is-scrollable::after {
    opacity: 1;
}

.admin-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
}

.admin-table th {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    padding: 10px 12px 10px 0;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 12px 14px 0;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.admin-table td form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.admin-table td select {
    width: auto;
    min-width: 120px;
    flex: 1 1 120px;
}

.admin-table td button {
    flex-shrink: 0;
}

/* ——— Pricing ——— */
.plan-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    margin-top: 20px;
}

.plan-card {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--surface);
}

.plan-card--featured {
    border-color: rgba(181, 52, 40, 0.28);
    box-shadow: inset 0 0 0 1px rgba(181, 52, 40, 0.08);
}
.plan-card h3 { margin: 0 0 8px; font-size: 20px; }
.plan-price {
    font-family: var(--serif);
    font-size: clamp(28px, 5vw, 32px);
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}
.plan-card ul { margin: 16px 0; padding-left: 18px; color: var(--muted); }
.plan-card li { margin-bottom: 6px; }

/* ——— Pagination ——— */
.pager { margin: 28px 0 8px; }

.pager-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.pager-item a,
.pager-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch);
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 2px;
    text-decoration: none;
    font-size: 14px;
    color: var(--muted);
}

.pager-item a:hover {
    color: var(--ink);
    background: rgba(18, 18, 17, 0.04);
}

.pager-item.active span {
    background: var(--ink);
    color: #fff;
}

.pager-item.disabled span {
    opacity: 0.4;
}

/* ——— Misc ——— */
.flash {
    margin-top: 20px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    color: #2d5a3d;
    background: transparent;
}

.flash.error { color: var(--accent); }

.notice {
    margin-top: 24px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: #6b5520;
    font-size: 15px;
}

.code {
    display: block;
    word-break: break-all;
    font-size: 13px;
    color: var(--muted);
    padding: 12px 0;
    border-top: 1px solid var(--line);
    overflow-x: auto;
}

.row-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    align-items: flex-start;
}

.row-item a {
    overflow-wrap: anywhere;
}

.foot {
    border-top: 1px solid var(--line);
    margin-top: 0;
    padding: clamp(24px, 4vw, 32px) 0 max(44px, env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 14px;
}

.foot-inner { display: grid; gap: 28px; }

.foot-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.foot-brand {
    font-family: var(--serif);
    font-size: 22px;
    text-decoration: none;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.foot-brand b { color: var(--accent); font-weight: 600; }

.foot-nav ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.foot-nav li {
    display: flex;
    align-items: center;
}

.foot-nav li + li::before {
    content: "·";
    margin: 0 12px;
    color: rgba(18, 18, 17, 0.22);
}

.foot-nav a {
    text-decoration: none;
    color: var(--muted);
}

.foot-nav a:hover { color: var(--ink); }
.foot a:hover { color: var(--ink); }

.foot-legal {
    max-width: 760px;
    line-height: 1.7;
    font-size: 13px;
}

.foot-legal p { margin: 0 0 12px; }
.foot-legal p:last-child { margin-bottom: 0; }

.foot-legal a {
    text-decoration: underline;
    text-decoration-color: rgba(18, 18, 17, 0.18);
    text-underline-offset: 3px;
}

.foot-keep { white-space: nowrap; }

.auth-box {
    max-width: 400px;
    margin: clamp(24px, 5vw, 40px) auto;
    padding: 32px 0;
    width: 100%;
}

.auth-back {
    margin-top: 24px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(16px, 3vw, 24px);
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 8px;
}

/* ——— Tablet ——— */
@media (max-width: 1099px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .side,
    .card.side {
        position: static;
        padding-top: 8px;
        border-top: 1px solid var(--line);
    }

    .post {
        grid-template-columns: 72px minmax(0, 1fr);
    }
}

@media (min-width: 640px) and (max-width: 1099px) {
    .side-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 32px;
        padding-top: 24px;
        border-top: 1px solid var(--line);
    }

    .side-cards .divider {
        display: none;
    }

    .side-cards .side-block {
        min-width: 0;
    }

    .stats-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .plan-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ——— Mobile nav ——— */
@media (max-width: 1099px) {
    .nav-toggle {
        display: inline-flex;
    }

    .nav-links a.is-active {
        box-shadow: none;
        color: var(--accent);
    }

    .nav-panel {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        min-height: calc(100dvh - var(--header-h));
        flex: none;
        z-index: 99;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px max(var(--wrap-pad), env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(var(--wrap-pad), env(safe-area-inset-left));
        background: var(--bg);
        box-shadow: -8px 0 32px rgba(18, 18, 17, 0.08);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        transform: translate3d(100%, 0, 0);
        transition: transform 0.25s ease, visibility 0.25s;
        visibility: hidden;
    }

    .top.nav-open .nav-panel {
        transform: translate3d(0, 0, 0);
        visibility: visible;
    }

    .nav-links {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0;
        flex: 0 0 auto;
    }

    .nav-links a {
        padding: 14px 0;
        border-bottom: 1px solid var(--line);
        font-size: 17px;
        white-space: normal;
    }

    .nav-user {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 24px;
        padding-top: 8px;
    }

    .nav-user a:not(.btn) {
        padding: 10px 0;
        font-size: 16px;
    }

    .nav-user .btn,
    .nav-user button {
        width: 100%;
    }
}

/* ——— Mobile ——— */
@media (max-width: 639px) {
    :root {
        --header-h: 56px;
    }

    .hero { padding-top: 20px; }
    .hero h1::after { margin-top: 12px; }

    .post {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .meter {
        display: flex;
        align-items: baseline;
        gap: 10px;
        flex-wrap: wrap;
    }

    .label { margin-top: 0; }

    .stats-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chip {
        min-height: 40px;
        display: inline-flex;
        align-items: center;
    }

    .tabs-scroll {
        margin-inline: calc(var(--wrap-pad) * -1);
        padding-inline: var(--wrap-pad);
    }

    .auth-box {
        padding: 24px 0 32px;
    }

    .content-narrow h2 {
        font-size: clamp(20px, 5vw, 24px);
        margin-top: 28px;
    }

    .content-narrow h2.h-reset:first-child {
        margin-top: 0;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }

    .plan-card {
        padding: 20px;
    }

    .admin-user-row {
        flex-direction: column;
    }

    .admin-actions-col {
        width: 100%;
    }

    .admin-actions-col .btn,
    .admin-actions-col button {
        width: 100%;
    }

    .foot-top {
        flex-direction: column;
        gap: 16px;
    }

    .foot-nav ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .foot-nav li + li::before {
        content: none;
        margin: 0;
    }

    .foot-nav a {
        display: block;
        padding: 6px 0;
    }

    .foot-keep {
        white-space: normal;
    }

    .row-item {
        flex-direction: column;
        gap: 4px;
    }

    .admin-table {
        min-width: 480px;
    }

    .admin-table td form {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-table td select,
    .admin-table td button {
        width: 100%;
    }

    .pager-list {
        justify-content: space-between;
    }

    .pager--simple .pager-list {
        justify-content: center;
    }
}

/* ——— Very small ——— */
@media (max-width: 380px) {
    .brand { font-size: 20px; }

    .tabs:not(.tabs-scroll) {
        gap: 4px;
    }

    .chip {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ——— Desktop nav density ——— */
@media (min-width: 1100px) and (max-width: 1180px) {
    .nav-links {
        gap: 6px 14px;
    }

    .nav-links a,
    .nav-user a:not(.btn) {
        font-size: 14px;
    }
}

@media (min-width: 1100px) and (max-width: 1140px) {
    .nav-links .nav-secondary {
        display: none;
    }
}

@media (min-width: 1280px) {
    .wrap {
        width: min(1120px, 100%);
    }

    .grid {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .hero {
        padding-top: 16px;
        padding-bottom: 4px;
    }

    .hero h1 {
        font-size: clamp(26px, 5vw, 36px);
    }

    .hero p {
        font-size: 15px;
    }

    .nav-panel {
        padding-top: 4px;
    }

    .nav-links a {
        padding: 10px 0;
    }
}

/* ——— PWA shell ——— */
body.has-tabbar {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

body.is-offline {
    padding-top: 36px;
}

body.is-offline .offline-banner {
    position: fixed;
}

.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #8a2f24;
}

.offline-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.offline-shell {
    max-width: 420px;
    text-align: center;
}

.offline-brand {
    font-size: 28px;
    margin-bottom: 12px;
}

.offline-back {
    margin-top: 20px;
}

.app-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(246, 245, 242, 0.96);
    border-top: 1px solid rgba(18, 18, 17, 0.1);
    backdrop-filter: blur(12px);
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 52px;
    padding: 4px 6px;
    border-radius: 12px;
    color: rgba(18, 18, 17, 0.62);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
}

.tabbar-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.tabbar-item svg path[stroke] {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.tabbar-item.is-active {
    color: var(--accent);
    background: rgba(181, 52, 40, 0.08);
}

.tabbar-item:active {
    transform: scale(0.96);
}

.install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 115;
}

body:not(.has-tabbar) .install-banner {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.install-banner-inner {
    padding: 14px 16px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(18, 18, 17, 0.12);
    box-shadow: 0 12px 32px rgba(18, 18, 17, 0.14);
}

.install-banner-text {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.45;
}

.install-ios-hint {
    margin: 0 0 10px;
    font-size: 13px;
    color: rgba(18, 18, 17, 0.7);
}

.install-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.install-banner-actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
}

.pull-indicator {
    position: fixed;
    top: 64px;
    left: 50%;
    z-index: 90;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    color: rgba(18, 18, 17, 0.72);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(18, 18, 17, 0.1);
    box-shadow: 0 6px 20px rgba(18, 18, 17, 0.08);
    pointer-events: none;
    transition: transform 0.12s ease;
}

.reaction.is-pressed {
    transform: scale(0.94);
    background: rgba(181, 52, 40, 0.14);
}

@media (max-width: 1099px) {
    body.has-tabbar .app-tabbar {
        display: grid;
    }

    body.has-tabbar .foot {
        padding-bottom: 12px;
    }
}

/* ——— Reduced motion ——— */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .nav-panel,
    .nav-toggle span,
    .pull-indicator,
    .tabbar-item,
    .reaction {
        transition: none;
    }
}
