:root {
    --bg: #eef2fb;
    --card-bg: #ffffff;
    --text: #1f2430;
    --text-muted: #6b7280;
    --border: #e3e8f4;
    --brand: #2f6bff;
    --brand-dark: #1d4fd1;
    --ok-bg: #d4edda; --ok-fg: #155724;
    --warn-bg: #fff3cd; --warn-fg: #856404;
    --bad-bg: #f8d7da; --bad-fg: #721c24;
    --shadow: 0 1px 3px rgba(31, 36, 48, 0.08);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

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

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

header.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
}
.logo { font-size: 22px; font-weight: 700; color: var(--brand); }
.logo span { color: var(--text); font-weight: 400; }
nav.site-nav a { margin-left: 20px; color: var(--text); font-weight: 500; }
nav.site-nav a.cta {
    background: var(--brand);
    color: #fff;
    padding: 9px 18px;
    border-radius: 8px;
}
nav.site-nav a.cta:hover { background: var(--brand-dark); text-decoration: none; }

.card {
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-title {
    font-weight: 700;
    font-size: 17px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

/* ---- Лендинг ---- */
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: 38px; margin: 0 0 14px; }
.hero p.lead { font-size: 18px; color: var(--text-muted); max-width: 640px; margin: 0 auto 28px; }
.btn-primary {
    display: inline-block;
    background: var(--brand);
    color: #fff;
    padding: 14px 30px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
}
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }

.stat-row { display: flex; gap: 20px; justify-content: center; margin: 40px 0; flex-wrap: wrap; }
.stat-tile {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px 30px;
    text-align: center;
    min-width: 190px;
    box-shadow: var(--shadow);
}
.stat-tile .num { font-size: 30px; font-weight: 800; color: var(--brand); }
.stat-tile .label { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.how-it-works { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 40px 0; }
.step { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.step .n { color: var(--brand); font-weight: 800; font-size: 22px; }
.step h3 { margin: 8px 0; font-size: 16px; }
.step p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ---- Таблица закупок ---- */
table.purchases {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.purchases th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.purchases td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.purchases tr:hover { background: #f7f9ff; }
table.purchases tr.curated { background: #f9fbff; }
table.purchases td.col-title { max-width: 420px; }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { text-decoration: underline; }
.title-line {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.row-sub {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.showcase-tag {
    display: inline-block;
    background: #fff2d9;
    color: #8a5a00;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.status-active { color: #1a9e4a; font-weight: 600; }
.status-closed { color: var(--text-muted); font-weight: 600; }

/* ---- Карточка закупки ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.purchase-header h1 { font-size: 22px; margin: 0 0 6px; }
.purchase-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 4px; }

.position { border-bottom: 1px solid var(--border); }
.position:last-child { border-bottom: none; }
.position-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    cursor: pointer;
    font-weight: 600;
}
.position-head:hover { background: #f7f9ff; }
.position-sub { color: var(--text-muted); font-weight: 400; font-size: 13px; }
.product-list { padding: 0 22px 14px; display: none; }
.position.open .product-list { display: block; }
.product-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.product-item:hover { background: #f2f5ff; }
.product-item.selected { background: #e7edff; font-weight: 600; }
.product-sub { display: block; color: var(--text-muted); font-weight: 400; font-size: 12px; margin-top: 2px; }

.flag-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    margin-left: 6px;
}
.flag-restrict { background: var(--bad-bg); color: var(--bad-fg); }
.flag-pref { background: var(--ok-bg); color: var(--ok-fg); }

.econ-box {
    background: #f7f9ff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.econ-title { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.econ-badge {
    background: #e7edff;
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}
.econ-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.econ-grid div { font-size: 12px; color: var(--text-muted); }
.econ-grid strong { display: block; color: var(--text); font-size: 14px; font-weight: 700; margin-top: 2px; }
.econ-profit { color: #1a9e4a; }
.econ-note { font-size: 11px; color: var(--text-muted); margin: 10px 0 0; }

/* Карточка характеристик всегда на экране при скролле длинного списка товаров
   слева; если сама характеристик много — скроллится содержимое карточки, а не
   вся страница. */
.chars-card {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}
.chars-card .card-title { flex: 0 0 auto; }
.chars-card .locked-wrapper { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 900px) {
    .chars-card { position: static; max-height: none; }
    .chars-card .locked-wrapper { overflow-y: visible; }
}

.chars-panel { display: none; padding: 18px 22px; }
.chars-panel.active { display: block; }
.char-row { border-bottom: 1px solid var(--border); padding: 12px 0; }
.char-row:last-child { border-bottom: none; }
.char-name { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.char-values { display: flex; gap: 24px; font-size: 13px; color: var(--text-muted); }
.char-values div span { display: block; color: var(--text); font-weight: 500; }

.locked-wrapper { position: relative; }
.locked .chars-inner { filter: blur(5px); pointer-events: none; user-select: none; }
.lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255,255,255,0.55);
    text-align: center;
    padding: 20px;
}
.lock-overlay p { max-width: 280px; color: var(--text); font-weight: 600; margin: 0; }

/* ---- Полный продукт: баннер режима, поиск, пагинация ---- */
.mode-banner {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 10px;
    margin-top: 20px;
}
.search-form { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search-form input[type=text] {
    flex: 1;
    max-width: 420px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.search-form .btn-primary { padding: 10px 20px; font-size: 14px; }
.search-form .clear-search { color: var(--text-muted); font-size: 13px; }
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 40px;
    font-size: 14px;
    color: var(--text-muted);
}
.pagination a { font-weight: 600; }

.sort-link { color: var(--text-muted); font-weight: 600; }
.sort-link:hover { color: var(--text); text-decoration: none; }
.sort-link.active { color: var(--brand); }
.sort-arrow { font-size: 10px; }
.profit-pos { color: #1a9e4a; font-weight: 600; }
.profit-neg { color: #c0392b; font-weight: 600; }

/* ---- Логин "полного продукта" ---- */
.login-wrap { display: flex; justify-content: center; padding: 60px 0; }
.login-card { padding: 32px; width: 360px; max-width: 100%; }
.login-card h1 { font-size: 20px; margin: 0 0 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin: 0 0 20px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.login-card input[type=text], .login-card input[type=password] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.login-error { color: var(--bad-fg); font-size: 13px; margin-top: 12px; }

/* ---- Модалка лида ---- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 25, 40, 0.45);
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    width: 380px;
    max-width: 92vw;
}
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.modal p.sub { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.modal input[type=text], .modal input[type=email], .modal input[type=tel] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}
.modal .consent { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 12px; color: var(--text-muted); }
.modal .consent input { margin-top: 3px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; float: right; font-size: 18px; }
.form-error { color: var(--bad-fg); font-size: 13px; margin-top: 8px; display: none; }

footer.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 40px 0;
}
