:root {
    --ink: #1c1d1a;
    --muted: #5c615c;
    --paper: #ffffff;
    --white: #ffffff;
    --line: #e2ded6;
    --yellow: #f0b429;
    --green: #1b7a43;
    --rust: #8d3b2c;
    --amber: #8a5a12;
    --max: 1520px;
    --card: 6px;
    --font: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --radius: 999px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.45;
    font-size: 16px;
}

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

button, input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

h1, h2, h3, p { margin-top: 0; }

h1 {
    margin-bottom: 8px;
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 700;
}

h2 { font-size: 1.2rem; font-weight: 700; }

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

.skip {
    position: absolute;
    left: 12px;
    top: -48px;
    background: var(--white);
    padding: 8px 12px;
    z-index: 40;
    border-radius: 8px;
}

.skip:focus { top: 12px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

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

.page { padding: 8px 0 72px; }

.narrow { max-width: 560px; }

.support { color: var(--muted); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.header-bar {
    width: min(var(--max), calc(100% - 32px));
    margin-inline: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
        "brand phone cart"
        "search search search";
    gap: 10px 12px;
    align-items: center;
    padding: 12px 0;
}

.brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
}

.brand img {
    display: block;
    height: 30px;
    width: auto;
    max-width: 100%;
}

.search-form {
    grid-area: search;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.search-form input {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    padding: 0 16px;
    font-size: 16px;
}

.search-form button {
    min-height: 48px;
    border: 0;
    border-radius: var(--radius);
    background: var(--ink);
    color: white;
    font-weight: 650;
    cursor: pointer;
}

.header-phone, .header-cart {
    text-decoration: none;
    font-weight: 650;
    white-space: nowrap;
}

.header-phone { grid-area: phone; }
.header-cart { grid-area: cart; }
.header-cart span { margin-left: 4px; }

.machine-bar {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--card);
    padding: 10px 10px 10px 14px;
}

.machine-bar p { margin: 0; min-width: 0; line-height: 1.25; }
.machine-bar p strong { display: block; }
.machine-bar p a { font-weight: 700; text-decoration: none; }
.machine-bar > a {
    display: inline-flex;
    align-items: center;
    flex: none;
    min-height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: #f4f4f4;
    text-decoration: none;
    font-weight: 650;
    white-space: nowrap;
}

.hero { padding: 20px 0 8px; }
.hero-grid { display: grid; gap: 16px; }
.hero-visual {
    height: 220px;
    border-radius: var(--card);
    overflow: hidden;
    background: #ffffff;
}
.hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 62%;
}
.actions { display: grid; gap: 10px; margin: 16px 0; }
.facts, .continue { max-width: 40rem; }
.facts a, .continue a { font-weight: 650; }

.section { padding: 28px 0 64px; }

.model-index {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.model {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 120px;
    padding: 12px;
    border-radius: var(--card);
    border: 1px solid var(--line);
    background-color: #1c1d1a;
    background-size: cover;
    background-position: center;
    color: white;
    text-decoration: none;
    font-size: 1.45rem;
    font-weight: 700;
    overflow: hidden;
}

.model::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.08));
}

.model span { position: relative; }

.model.is-open { border-color: var(--ink); border-width: 2px; }

.gen-panel { grid-column: 1 / -1; padding-top: 4px; }
.gen-panel p { margin-bottom: 8px; font-weight: 650; }
.gens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gens button {
    min-height: 56px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 650;
    background: transparent;
}

.btn-yellow {
    width: 100%;
    background: var(--yellow);
    color: var(--ink);
    border-color: var(--yellow);
}

.btn-line {
    width: 100%;
    background: var(--white);
    border-color: var(--line);
    color: var(--ink);
}

.btn-text {
    width: auto;
    border: 0;
    background: transparent;
    min-height: 44px;
    padding: 0;
    text-decoration: underline;
    font-weight: 600;
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.crumbs a { color: var(--ink); }

.machine-hero { margin-bottom: 16px; }
.machine-hero img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    object-position: center 60%;
    border-radius: var(--card);
    background: #ffffff;
    margin-bottom: 14px;
}

.segment {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.segment a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--white);
    text-decoration: none;
}

.segment a.is-on {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
}

.cat-index { display: grid; gap: 8px; }
.cat-index a {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    min-height: 132px;
    padding: 14px;
    border-radius: var(--card);
    border: 1px solid var(--line);
    background-color: #1c1d1a;
    background-size: cover;
    background-position: center;
    color: white;
    text-decoration: none;
    font-size: 1.05rem;
    overflow: hidden;
}
.cat-index a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.12));
}
.cat-index strong, .cat-index span { position: relative; font-weight: 650; color: white; }

.cards { display: grid; gap: 10px; }

.part-row {
    display: grid;
    gap: 0;
    padding: 0;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
    overflow: hidden;
}

.part-photo {
    display: block;
    min-height: 150px;
    background-color: #f2f2f2;
    background-size: cover;
    background-position: center;
}

.part-row-body { display: grid; gap: 12px; padding: 14px; }

.part-row-main {
    display: grid;
    gap: 2px;
    text-decoration: none;
}

.part-code { color: var(--muted); font-variant-numeric: tabular-nums; }
.part-copy { display: grid; gap: 2px; }
.part-copy strong { font-size: 1.1rem; }
.part-copy em { font-style: normal; color: var(--muted); }
.part-row-end { display: grid; gap: 8px; }
.part-row-end .price { font-size: 1.15rem; }

.price { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }

.product { display: grid; gap: 12px; }
.product-machine {
    width: 100%;
    height: 220px;
    object-fit: cover;
    object-position: center 60%;
    border-radius: var(--card);
    background: #ffffff;
}
.plate-code { color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 10px; }

.choose { margin: 18px 0 8px; }

.offers { display: grid; gap: 8px; }
.offer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: center;
    min-height: 72px;
    padding: 12px 14px;
    border-radius: var(--card);
    border: 1px solid var(--line);
    background: var(--white);
    text-decoration: none;
}
.offer strong, .offer small { display: block; }
.offer small { color: var(--muted); font-weight: 500; }
.offer-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.offer.is-selected { border-color: var(--ink); border-width: 2px; }

.status { display: inline-flex; align-items: center; gap: 6px; }
.status-mark { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-stock { color: var(--green); }
.status-out { color: var(--rust); }
.status-inquiry { color: var(--amber); }
.fit-ok { color: var(--green); font-weight: 650; }
.fit-bad { color: var(--rust); font-weight: 650; }

.fit-list { margin: 8px 0 12px; }
.fit-list summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.fit-list ul { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 8px; list-style: none; }
.fit-list a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--white);
    border: 1px solid var(--line);
    text-decoration: none;
    font-weight: 650;
}

.buy { display: grid; gap: 12px; margin: 16px 0; }
.qty {
    display: inline-grid;
    grid-template-columns: 48px 48px 48px;
    width: fit-content;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}
.qty a, .qty button, .qty > span {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: none;
    padding: 0;
}

.help {
    margin-top: 8px;
    padding: 16px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
}
.help h2 { font-size: 1.05rem; margin-bottom: 6px; }
.help .btn { margin-top: 8px; }

.empty-request { margin-top: 16px; }
.empty-request.quiet { margin-top: 24px; }
.banner {
    margin: 12px 0;
    padding: 14px 16px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
}
.limit {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--rust);
    background: #f8ece8;
}

.cart-layout { display: grid; gap: 16px; }
.cart-line {
    display: grid;
    gap: 8px;
    padding: 14px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
}
.cart-line h2 { font-size: 1.1rem; margin-bottom: 4px; }
.cart-line h2 a { text-decoration: none; }
.line-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.summary {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
}

.stack-form, .fields { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; font-weight: 650; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--card);
    background: var(--white);
    padding: 10px 14px;
    font-weight: 500;
}
.field textarea { min-height: 110px; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 700; margin-bottom: 8px; }
.order-lines { list-style: none; padding: 0; margin: 0 0 12px; }
.order-lines li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.admin { display: grid; gap: 16px; }
.part-list {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow: auto;
    gap: 6px;
    order: 2;
}
.part-list a {
    padding: 10px 12px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
    text-decoration: none;
}
.part-list a.is-on { border-color: var(--ink); }
.part-list small { display: block; color: var(--muted); font-weight: 500; }
.admin-editor { order: 1; min-width: 0; }
.matrix-wrap { overflow-x: auto; margin: 8px 0 16px; border-radius: var(--card); background: var(--white); }
.matrix { width: 100%; min-width: 480px; border-collapse: collapse; }
.matrix th, .matrix td { padding: 8px; border-bottom: 1px solid var(--line); text-align: center; }
.matrix th:first-child, .matrix td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--white);
}
.matrix input { width: 22px; height: 22px; }
.row-toggle {
    background: none;
    border: 0;
    padding: 8px 0;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
}
.reorder-list { display: grid; gap: 8px; }
.reorder-list article {
    padding: 14px;
    border-radius: var(--card);
    background: var(--white);
    border: 1px solid var(--line);
}
.reorder-list dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 0;
}
.reorder-list dt { color: var(--muted); font-size: 0.85rem; }
.reorder-list dd { margin: 0; font-weight: 700; }
.reset { margin-top: 24px; }

.site-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0 40px;
}
.footer-grid { display: grid; gap: 16px; }
.footer-grid p { margin: 0 0 6px; }
.footer-note { color: var(--muted); }
.site-footer a { text-decoration: none; }
.site-footer .brand img { height: 36px; }

@media (min-width: 640px) {
    h1 { font-size: 2.25rem; }
    .actions { display: flex; flex-wrap: wrap; }
    .btn-yellow, .btn-line, .part-row-end .btn, .help .btn, .summary .btn, .empty-request .btn { width: auto; }
    .search-form { flex-direction: row; align-items: center; }
    .search-form input { border-radius: var(--radius); }
    .search-form button { width: auto; padding: 0 18px; border-radius: var(--radius); }
    .part-row { grid-template-columns: 220px minmax(0, 1fr); }
    .part-photo { min-height: 100%; }
    .part-row-body { align-content: center; }
    .part-row-end { grid-template-columns: auto auto auto; align-items: center; justify-content: end; }
    .buy { display: flex; align-items: center; }
    .fields.cols-2 { grid-template-columns: 1fr 1fr; }
    .model-index { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .hero-visual { height: 320px; }
    .machine-hero img, .product-machine { height: 280px; }
}

@media (min-width: 900px) {
    .brand img { height: 42px; }
    .header-bar {
        grid-template-columns: auto minmax(240px, 1fr) auto auto;
        grid-template-areas: "brand search phone cart";
    }
    .hero-grid { grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 28px; }
    .hero { padding-top: 36px; }
    .product { grid-template-columns: minmax(240px, 420px) minmax(0, 1fr); align-items: start; }
    .cart-layout { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
    .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
    .cat-index { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
    .admin { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
    .part-list { order: 0; max-height: calc(100vh - 140px); position: sticky; top: 88px; }
    .admin-editor { order: 0; }
}

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