:root {
    --brand: #1f6feb;
    --bg: #0d1117;
    --fg: #c9d1d9;
    --muted: #8b949e;
    --card: #161b22;
    --ok: #2ea043;
}

/*  Базовые стили  */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
}

/*  Шапка сайта  */
header {
    position: sticky;
    top: 0;
    background: rgba(13, 17, 23, .85);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid #30363d;
}

.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/*  Панель управления (селекты, кнопки)  */
.controls {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

select, button {
    background: #0b1220;
    color: var(--fg);
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 10px 12px;
}

button.primary {
    background: var(--brand);
    border-color: var(--brand);
}

/*  Сетка карточек товаров  */
.grid {
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

/*  Карточка товара  */
.card {
    background: var(--card);
    border: 1px solid #30363d;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
}

.card .pad {
    padding: 12px;
}

.title {
    font-weight: 600;
}

.price {
    color: #fff;
    margin-top: 6px;
}

/*  Обёртка для изображения  */
.img-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
}

.img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s ease;
}

.card:hover .img-wrap img {
    transform: scale(1.03);
}

/*  Бейджи и чипы (унифицированная система)  */
.badges {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.badge, .chip {
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid #2f81f7;
    background: #0b1a33;
}

/* Варианты */
.badge.express, .chip.fast {
    border-color: var(--ok);
    background: #0b1f13;
    color: #7ee787;
    font-weight: 700;
}

.badge.loc, .chip.stock {
    border-color: #6e7681;
    background: #141a22;
    color: #adb3ba;
}

/* бейдж для экспресс-доставки */
.truck-icon {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 60px !important;
    height: 60px !important;
}

/*  Блок мета-информации (чипы)  */
.meta {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/*  Кнопки действий  */
.actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.btn {
    flex: 1;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #2f81f7;
    background: #0b1a33;
    color: var(--fg);
    cursor: pointer;
    font-weight: 600;
    transition: background .15s, border-color .15s, transform .02s;
    width: 100%;
}

.btn:hover {
    background: #0f2446;
}

.btn:active {
    transform: translateY(1px);
}

.btn.primary, .btn.more {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn.primary:hover, .btn.more:hover {
    filter: brightness(1.05);
}

/*  Всплывающие уведомления  */
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    background: #111827;
    border: 1px solid #374151;
    color: #e5e7eb;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    display: none;
}

/*  Модальное окно (геолокация)  */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, .5);
    z-index: 1000;
}

.modal[aria-hidden="false"] {
    display: flex;
}

.modal_dialog {
    width: min(520px, 92vw);
    background: var(--card);
    border: 1px solid #30363d;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    padding: 20px 20px 18px;
    position: relative;
}

.modal_close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: 0;
    color: var(--fg);
    font-size: 20px;
    cursor: pointer;
}

.modal_icon {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 8px;
}

.modal_title {
    margin: 0 0 6px;
    font-size: 22px;
}

.modal_text {
    margin: 0 0 14px;
    color: var(--muted);
}

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

.modal_note {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--muted);
}

/* Кнопки в модальном окне */
#modalDetect, #modalManual {
    width: 100%;
}

/* Кнопка сброса (опасное действие) */
#resetSession {
    border-color: #b91c1c;
    color: #f87171;
}

#resetSession:hover {
    background: #450a0a;
}

/*  Утилитарные классы  */
.w-100 {
    width: 100%;
}

.mt-30-px {
    margin-top: 30px;
}

.text-center {
    text-align: center;
}