/* 1.1 palette */
:root {
    color-scheme: light;
    --bg: #ffffff;
    --bg-alt: #f5f7fa;
    --surface: #ffffff;
    --ink: #0f172a;
    --ink-2: #6b7280;
    --line: #e5e7eb;
    --primary: #0b3c5d;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --success: #16a34a;
    --danger: #dc2626;
    --sidebar-w: 240px;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.06);
    --font: Manrope, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --surface: #1e293b;
    --ink: #f1f5f9;
    --ink-2: #94a3b8;
    --line: #334155;
    --primary: #60a5fa;
    --accent: #fb923c;
    --accent-hover: #f97316;
}

/* 1.2 type */
* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
}

h1, h2, h3 { font-weight: 700; margin: 0 0 16px; }
h1 { font-size: 48px; line-height: 1.15; }
h2 { font-size: 32px; line-height: 1.25; }
h3 { font-size: 22px; line-height: 1.35; }
p { margin: 0 0 12px; }
a { color: var(--primary); }
img { max-width: 100%; display: block; }

.lead { font-size: 20px; line-height: 1.5; color: var(--ink-2); }
.muted { color: var(--ink-2); font-size: 14px; }

/* 1.3 grid */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    grid-template-rows: 36px minmax(0, 1fr);
    min-height: 100vh;
}

.sheet { display: contents; }

.content { grid-column: 2; grid-row: 2; min-width: 0; }
.content-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

.grid-2, .grid-3, .grid-4, .split-60, .mission, .start {
    display: grid;
    gap: 24px;
}
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-60 { grid-template-columns: 3fr 2fr; }
.mission { grid-template-columns: 1fr 1fr; align-items: start; }

/* 1.4 radius and shadow */
.card, .btn, .menu-panel, .brand-plate, .requisites, .page-cover, .hero, .plasma, .yandex-map, .pending-plate {
    border-radius: 10px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-1);
    padding: 24px;
}

/* 1.5 icons */
.icon { width: 20px; height: 20px; flex: none; display: block; }
.icon-md { width: 28px; height: 28px; }
.icon-xl { width: 48px; height: 48px; color: var(--accent); }

/* 1.6 motion */
.btn, .card.lift, .nav-link, .sheet, .icon-btn {
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }

/* 2.1 top bar */
.topbar {
    grid-column: 1 / -1;
    grid-row: 1;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    line-height: 1.2;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.brand-mark { color: var(--accent); }
.top-center {
    flex: 1;
    margin: 0;
    text-align: center;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.clock { font-variant-numeric: tabular-nums; color: var(--ink); }
.icon-btn, .text-btn, .user-btn, .menu-panel button {
    font: inherit;
    color: var(--ink);
    background: transparent;
    border: 0;
    cursor: pointer;
}
.icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}
.icon-btn:hover, .user-btn:hover, .text-btn:hover { background: var(--bg); }
.lang-btn, .user-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: 6px; }
.text-btn { text-decoration: none; font-weight: 700; padding: 0 8px; }
.avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-pill {
    font-size: 12px;
    line-height: 1.2;
    padding: 2px 8px;
    border: 1px solid var(--ink-2);
    border-radius: 999px;
    color: var(--ink-2);
    text-transform: none;
}
.role-pill.is-vip { background: var(--accent); border-color: var(--accent); color: #fff; }
.role-pill.is-admin { background: var(--danger); border-color: var(--danger); color: #fff; }
.menu { position: relative; }
.menu-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    padding: 6px;
    z-index: 20;
}
.menu.is-open .menu-panel { display: grid; }
.menu-panel a, .menu-panel button {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    color: var(--ink);
    background: transparent;
    border-radius: 6px;
    padding: 8px 10px;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--bg-alt); }
.menu-panel form { margin: 0; }

/* 2.2 sidebar */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 36px;
    align-self: start;
    height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
}
.side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 10px;
}
.side-logo { color: var(--accent); display: inline-flex; }
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 8px 8px; overflow: auto; }
.side-section {
    margin: 14px 8px 4px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
}
.nav-link:hover { background: var(--bg-alt); }
.nav-link.is-active { background: var(--primary); color: #fff; }
.nav-link.is-active:hover { background: var(--primary); }
.badge {
    margin-left: auto;
    font-size: 10px;
    line-height: 1.2;
    padding: 3px 6px;
    border-radius: 999px;
    background: var(--bg-alt);
    color: var(--ink-2);
}
.nav-link.is-active .badge { background: transparent; color: #fff; border: 1px solid currentColor; }
.side-foot { margin-top: auto; padding: 16px; font-size: 12px; color: var(--ink-2); }

@media (min-width: 901px) {
    html[data-sidebar="collapsed"] { --sidebar-w: 64px; }
    html[data-sidebar="collapsed"] .nav-label,
    html[data-sidebar="collapsed"] .badge,
    html[data-sidebar="collapsed"] .side-section,
    html[data-sidebar="collapsed"] .side-foot { display: none; }
    html[data-sidebar="collapsed"] .nav-link { justify-content: center; padding-inline: 0; }
    html[data-sidebar="collapsed"] .side-head { justify-content: center; }
    html[data-sidebar="collapsed"] .nav-link { position: relative; }
    html[data-sidebar="collapsed"] .nav-link:hover::after {
        content: attr(data-label);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--ink);
        color: var(--bg);
        font-size: 12px;
        line-height: 1.2;
        padding: 6px 8px;
        border-radius: 6px;
        white-space: nowrap;
        z-index: 5;
    }
    html[data-sidebar="collapsed"] [data-sidebar-toggle] .icon { transform: rotate(180deg); }
}

/* 2.3 main, crumbs, footer */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; color: var(--ink-2); font-size: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.site-footer { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--line); }
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.site-footer h2 { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.copyright { margin-top: 24px; color: var(--ink-2); font-size: 14px; }

.content-inner > section,
.metric-row,
.brands { margin-top: 48px; }
.content-inner > section:first-child,
.content-inner > .hero { margin-top: 0; }

/* 3.1 hero */
.hero {
    min-height: 520px;
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    background: var(--bg-alt);
    padding: 40px;
    border-radius: 12px;
}
.hero-media img, .media-pending, .start-photo img {
    width: 100%;
    height: 100%;
    min-height: 320px;
    object-fit: cover;
    border-radius: 10px;
}
.media-pending {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #d5dbe3;
    color: #4b5563;
    text-align: center;
    padding: 16px;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.metric { display: grid; gap: 8px; align-content: start; }
.metric p { margin: 0; font-weight: 700; }

/* 3.2 values, 3.3 assortment */
.assortment { color: var(--ink); text-decoration: none; display: grid; gap: 12px; align-content: start; }

/* 3.4 brands */
.kicker {
    margin: 24px 0 12px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.brand-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.partner { display: grid; gap: 8px; justify-items: center; }
.partner-desc { margin: 0; max-width: 30mm; font-size: 14px; color: var(--ink-2); text-align: center; }
.brand-plate {
    display: inline-flex;
    align-items: flex-end;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}
.brand-plate.tier-1 { width: 30mm; height: 14mm; }
.brand-plate.tier-2 { width: 26mm; height: 12mm; }
.tier-sign-1 { height: 8mm; width: auto; }
.tier-sign-2 { height: 7mm; width: auto; }
.brand-plate.is-placeholder {
    align-items: center;
    background: #e5e7eb;
    color: #334155;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    padding: 2px;
}

/* 3.5 start */
.start { grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); align-items: center; }
.start-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.start-list li { display: grid; grid-template-columns: auto 1fr; gap: 16px; }
.start-num { font-size: 40px; line-height: 1; font-weight: 700; color: var(--accent); }

/* 3.6 cta */
.plasma {
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    padding: 40px;
}
.plasma h2, .plasma .lead { color: #fff; }

/* 3.7 news */
.news-card { padding: 0; overflow: hidden; color: var(--ink); text-decoration: none; display: block; }
.news-cover { display: block; height: 140px; background: #d5dbe3; }
.news-title { display: block; padding: 16px; font-weight: 700; }

/* 4 about */
.page-cover {
    background: var(--bg-alt);
    border-radius: 12px;
    padding: 32px;
}
.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 18px; }
.person h3 { margin-bottom: 4px; }

/* 5 products */
.pending-plate {
    min-height: 400px;
    background: var(--bg-alt);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    padding: 32px;
}
.not-found-plate { min-height: 320px; }
.notify-form, .stack-form { display: grid; gap: 12px; margin-top: 24px; max-width: 420px; }
.notify-form h2 { font-size: 22px; }

/* 6 contacts and 4.6 requisites */
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.contact-list li { display: grid; gap: 2px; }
.contact-list span:first-child { color: var(--ink-2); font-size: 14px; }
.requisites {
    background: var(--bg-alt);
    border-radius: 12px;
    padding: 28px;
}
.req-empty-list { margin: 16px 0 0; display: grid; gap: 12px; }
.req-empty-list div { display: grid; gap: 6px; }
.req-empty-list dt { font-size: 14px; color: var(--ink-2); }
.req-empty-list dd { margin: 0; min-height: 28px; border-bottom: 1px solid var(--line); }

/* 4.8 / 8 map */
.yandex-map {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 6;
    min-height: 420px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-alt);
}
.yandex-map iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
.map-note {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

/* 8 forms */
label { display: grid; gap: 6px; font-size: 14px; }
input, textarea {
    font: inherit;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-on-primary { background: #fff; color: var(--primary); }
.btn-outline-light { background: transparent; color: #fff; border-color: #fff; }
.flash, .form-errors {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.flash { background: color-mix(in srgb, var(--success) 14%, var(--surface)); border: 1px solid var(--success); }
.form-errors { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid var(--danger); color: var(--danger); }
.form-errors p { margin: 0; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* mobile: top bar becomes a bottom sheet */
.dock {
    display: none;
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-alt);
    border-top: 1px solid var(--line);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
}

@media (max-width: 900px) {
    h1 { font-size: 32px; }
    h2 { font-size: 26px; }
    .app { display: block; }
    .sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        z-index: 30;
        left: 0;
        right: 0;
        bottom: 56px;
        max-height: min(78vh, 680px);
        overflow: auto;
        background: var(--surface);
        border-top: 1px solid var(--line);
        box-shadow: var(--shadow-2);
        transform: translateY(110%);
        visibility: hidden;
    }
    html[data-mobile="open"] .sheet { transform: translateY(0); visibility: visible; }
    .topbar { height: auto; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
    .top-center { flex: 1 1 100%; text-align: left; white-space: normal; }
    .sidebar { position: static; height: auto; width: auto; border-right: 0; }
    .content-inner { padding: 20px 16px 88px; }
    .hero, .start, .grid-2, .grid-3, .grid-4, .split-60, .mission, .footer-grid { grid-template-columns: 1fr; }
    .hero { min-height: 0; padding: 24px; }
    .map-note { flex-direction: column; align-items: flex-start; }
    .yandex-map { aspect-ratio: 4 / 3; min-height: 320px; }
    .dock { display: flex; }
    .user-name { max-width: 42vw; }
}

@media (max-width: 1100px) and (min-width: 901px) {
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}
