:root {
    --bg: #f6f8f2;
    --surface: #fff;
    --text: #223025;
    --muted: #68736a;
    --primary: #4d7c3f;
    --dark: #365f2b;
    --soft: #dcebd5;
    --border: #dfe7dc;
    --shadow: 0 12px 32px rgba(48, 72, 45, .10);
    --radius: 18px;
    --container: 1200px
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    line-height: 1.5
}

a {
    color: inherit;
    text-decoration: none
}

img {
    display: block;
    max-width: 100%
}

.container {
    width: min(calc(100% - 32px), var(--container));
    margin: auto
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(246, 248, 242, .95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px)
}

.header-row {
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 20px
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px
}

.brand span {
    display: grid
}

.brand small {
    color: var(--muted)
}

.main-nav {
    display: flex;
    gap: 22px;
    margin-left: auto
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer
}

.form-card button.button {
    font-size: 22px;
    font-weight: 700;
}

.primary {
    background: var(--primary);
    color: #fff
}

.outline {
    background: #fff;
    border-color: var(--border)
}

.menu-toggle {
    display: none
}

.hero,
.section {
    padding: 42px 0
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.25fr .75fr;
    gap: 24px
}

.hero-copy,
.hero-art {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden
}

.hero-copy {
    padding: clamp(28px, 5vw, 60px)
}

.hero h1 {
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    line-height: 1;
    margin: .3em 0
}

.hero p {
    font-size: 1.1rem;
    color: var(--muted)
}

.hero-art img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.eyebrow {
    background: var(--soft);
    padding: 7px 11px;
    border-radius: 999px
}

.search-panel,
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px
}

.search-panel input,
.filters input,
.filters select,
.form-card input,
.form-card select,
.form-card textarea {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff
}

.search-panel input {
    flex: 1
}

.section h1,
.section h2 {
    font-size: clamp(1.7rem, 3vw, 2.5rem)
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.categories {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px
}

.category {
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    gap: 12px
}

.category span {
    font-size: 1.8rem
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px
}

.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow)
}

.product-media {
    aspect-ratio: 4/3;
    background: #eef2e8
}

.product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.product-body {
    padding: 16px
}

.product-body h3 {
    min-height: 48px
}

.price {
    font-size: 1.25rem;
    font-weight: 700
}

.price small {
    font-size: .8rem;
    color: var(--muted)
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px
}

.steps article,
.form-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow)
}

.steps b {
    font-size: 2rem;
    color: var(--primary)
}

.site-footer {
    padding: 36px 0;
    background: #fff;
    border-top: 1px solid var(--border)
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px
}

.footer-grid>div {
    display: grid;
    gap: 8px
}

.flash {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px
}

.flash.success {
    background: #e2f4dc
}

.flash.error {
    background: #fde3e3
}

.narrow {
    max-width: 720px
}

.form-card {
    display: grid;
    gap: 16px
}

.form-card label {
    display: grid;
    gap: 6px;
    font-weight: 700
}

.form-card textarea {
    min-height: 150px;
    resize: vertical
}

.form-card fieldset {
    padding-left: 14px;
}

.form-card .check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 0;
    font-weight: 400;
}

.form-card .check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-height: auto;
    margin: 0;
    flex-shrink: 0;
}

.ad-detail {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 28px
}

.gallery {
    display: grid;
    gap: 12px
}

.gallery img {
    width: 100%;
    border-radius: var(--radius);
    background: #fff
}

.big {
    font-size: 1.8rem
}

.notice {
    padding: 12px;
    background: #fff4d8;
    border-radius: 10px
}

.phone-result {
    margin-left: 10px;
    font-weight: 700
}

.pagination {
    display: flex;
    gap: 8px;
    margin-top: 24px
}

.pagination a {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px
}

.pagination .active {
    background: var(--primary);
    color: #fff
}

.table-wrap {
    overflow: auto
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff
}

th,
td {
    padding: 12px;
    border: 1px solid var(--border);
    text-align: left
}

.inline {
    display: inline-flex;
    gap: 4px;
    margin: 4px
}

.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: .2s;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 14px 18px
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none
}

@media(max-width:900px) {
    .header-row {
        flex-wrap: wrap
    }

    .main-nav {
        order: 10;
        width: 100%;
        display: grid;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height .3s, opacity .2s
    }

    .main-nav.is-open {
        max-height: 260px;
        opacity: 1;
        padding-bottom: 12px
    }

    .menu-toggle {
        display: block
    }

    .hero-grid,
    .ad-detail {
        grid-template-columns: 1fr
    }

    .hero-art img {
        max-height: 420px
    }

    .categories {
        grid-template-columns: repeat(4, 1fr)
    }

    .cards {
        grid-template-columns: repeat(2, 1fr)
    }
}

@media(max-width:640px) {
    .container {
        width: min(calc(100% - 20px), var(--container))
    }

    .header-actions .primary,
    .header-actions .outline {
        display: none
    }

    .categories {
        grid-template-columns: repeat(2, 1fr)
    }

    .cards,
    .steps,
    .footer-grid {
        grid-template-columns: 1fr
    }

    .filters>* {
        width: 100%
    }

    .site-header {
        position: static
    }

    .hero,
    .section {
        padding: 28px 0
    }

    .back-to-top {
        right: 12px;
        bottom: 12px
    }
}

/* ------------------------------------------------------------------------------- */

/* ===============================
   Дополнительные элементы интерфейса
   =============================== */

/* Ссылки */
a {
    transition: color .2s ease;
}

a:hover {
    color: #2f6b2f;
}

/* Кнопки */
.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
    transition:
        background-color .2s ease,
        color .2s ease,
        border-color .2s ease,
        transform .15s ease;
}

/* Основная зелёная */
.button.primary {
    background: #4d7c3f;
    color: #fff;
    border-color: #4d7c3f;
}

.button.primary:hover {
    background: #356f32;
    color: #fff;
}

/* Светлая */
.button.outline {
    background: #fff;
    color: #223025;
    border-color: #dfe7dc;
}

.button.outline:hover {
    background: #edf5ea;
    color: #223025;
    border-color: #4d7c3f;
}

/* Красная */
.button.danger {
    background: #b94a48;
    color: #fff;
    border-color: #b94a48;
}

.button.danger:hover {
    background: #8f3735;
    color: #fff;
}

/* Маленькие кнопки в таблицах */
.button.small {
    min-height: 36px;
    padding: 0 12px;
    font-size: 14px;
}

/* Формы внутри строки */
.inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px;
}

/* Выпадающий список статуса */
.status-select {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid #d7e1d3;
    background: #fff;
    color: #223025;
    cursor: pointer;
    transition:
        border-color .2s ease,
        box-shadow .2s ease;
}

.status-select:hover {
    border-color: #4d7c3f;
}

.status-select:focus {
    outline: none;
    border-color: #4d7c3f;
    box-shadow: 0 0 0 3px rgba(77,124,63,.15);
}

/* Checkbox */
input[type="checkbox"] {
    appearance: none;

    width: 20px;
    height: 20px;

    padding: 0;
    margin: 2px 12px 0 0;

    border: 2px solid #b8cbb3;
    border-radius: 5px;

    background: #fff;

    cursor: pointer;
    position: relative;

    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: #4d7c3f;
    border-color: #4d7c3f;
}

input[type="checkbox"]:checked::after {
    content: "✓";

    position: absolute;

    left: 1px;
    top: -2px;

    color: #fff;

    font-size: 16px;
    font-weight: 700;
}

/* Миниатюры существующих фото */
.ad-images-list {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.ad-image-item {
    width: 160px;
}

.ad-image-item img {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #dce6d8;
}

/* Превью новых загружаемых фото */
.file-preview {
    display:flex;
    flex-wrap:wrap;
    gap:16px;
    margin-top:18px;
}

.file-preview-item {
    width:120px;
    height:120px;
    position:relative;
}

.file-preview-item img {
    width:120px;
    height:120px;

    object-fit:cover;

    border-radius:12px;
}

.file-preview-remove {
    display: flex;
    align-items: center;
    justify-content: center;

    position: absolute;
    top: -8px;
    right: -8px;

    width: 28px;
    height: 28px;

    padding: 0;
    min-height: 0;

    border-radius: 50%;
    border: none;

    background: #b94a48;
    color: #fff;

    font-size: 18px;
    line-height: 1;

    cursor: pointer;
}

/* --------------------------- */

.ad-image-item {
    width: 160px;
    margin-bottom: 20px;
}

.ad-image-item form {
    margin-top: 12px;
}

/* --------------------------- */

.file-upload {
    display: block;
    cursor: pointer;
}

.file-upload .button {
    width: 100%;
}

.file-upload input[type="file"] {
    display: none;
}