:root {
    --bg: #ffffff;
    --ink: #122033;
    --muted: #5f6b7a;
    --line: #dce3eb;
    --soft: #f5f7fa;
    --blue: #1769e0;
    --blue-dark: #0c4dad;
    --green: #187b4d;
    --red: #b42318;
    --amber: #8a5a00;
    --shadow: 0 12px 34px rgba(18, 32, 51, .10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

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

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

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
}

.nav-toggle {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 8px 12px;
}

.site-nav {
    position: absolute;
    top: 60px;
    right: 14px;
    left: 14px;
    display: none;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.site-nav.is-open {
    display: grid;
}

.site-nav a {
    padding: 12px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
}

.site-nav a:hover {
    background: var(--soft);
    color: var(--ink);
}

.cart-badge {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    margin-left: 4px;
    place-items: center;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: 12px;
}

.hero,
.page,
.product-page,
.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.hero {
    display: grid;
    gap: 22px;
    padding: 32px 0 22px;
}

.hero h1,
.page-title h1,
.detail-copy h1 {
    margin: 0;
    color: var(--ink);
    font-size: 36px;
    line-height: 1.08;
}

.hero p,
.page-title p,
.detail-copy p,
.site-footer p {
    color: var(--muted);
}

.hero-actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

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

.button.primary:hover {
    background: var(--blue-dark);
}

.button.secondary {
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
}

.button.text {
    min-height: 36px;
    padding: 6px 10px;
    background: transparent;
    color: var(--blue);
}

.button.full {
    width: 100%;
}

.hero-panel,
.product-card,
.summary-box,
.auth-card,
.checkout-card,
.download-group,
.admin-panel,
.install-panel,
.empty-state {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 14px;
}

.mini-label,
.product-category {
    margin: 0 0 8px;
    color: var(--green);
    font-size: 13px;
    font-weight: 800;
}

.hero-product {
    display: grid;
    grid-template-columns: 54px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.hero-product img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.category-rail {
    display: flex;
    gap: 10px;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 28px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.category-rail::-webkit-scrollbar {
    display: none;
}

.category-rail a {
    flex: 0 0 auto;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-weight: 700;
}

.section-heading,
.filter-bar {
    display: grid;
    gap: 12px;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 16px;
}

.section-heading {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.section-heading h1,
.section-heading h2 {
    margin: 0;
}

.product-grid {
    display: grid;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 36px;
    gap: 14px;
}

.product-card {
    overflow: hidden;
}

.product-image {
    display: grid;
    min-height: 190px;
    place-items: center;
    background: var(--soft);
}

.product-image img {
    width: 82%;
    height: 170px;
    object-fit: contain;
}

.product-body {
    display: grid;
    gap: 10px;
    padding: 14px;
}

.product-body h3 {
    min-height: 46px;
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
}

.product-description {
    min-height: 72px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.price-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.price-row.big {
    font-size: 22px;
}

.was {
    color: var(--muted);
    text-decoration: line-through;
}

.now {
    color: var(--ink);
    font-weight: 900;
}

.download-band {
    display: grid;
    gap: 16px;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 42px;
    padding: 20px;
    border-radius: 8px;
    background: #eaf2ff;
}

.page {
    padding: 28px 0 42px;
}

.page.narrow,
.product-page {
    max-width: 880px;
}

.page-title {
    margin-bottom: 20px;
}

.filter-bar {
    grid-template-columns: 1fr;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
}

.product-detail {
    display: grid;
    gap: 22px;
    padding: 28px 0 42px;
}

.detail-image {
    display: grid;
    min-height: 300px;
    place-items: center;
    border-radius: 8px;
    background: var(--soft);
}

.detail-image img {
    width: min(380px, 86%);
    max-height: 320px;
    object-fit: contain;
}

.back-link {
    color: var(--blue);
    font-weight: 800;
}

.check-list {
    padding-left: 20px;
    color: var(--muted);
}

.buy-box,
.stack-form {
    display: grid;
    gap: 14px;
}

.cart-list,
.table-list {
    display: grid;
    gap: 10px;
}

.cart-row,
.table-row,
.summary-line,
.summary-total {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.cart-row span,
.table-row small {
    color: var(--muted);
}

.summary-box {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 16px;
}

.summary-total {
    border-color: var(--ink);
    font-size: 20px;
}

.checkout-grid,
.download-grid,
.metric-grid {
    display: grid;
    gap: 16px;
}

.checkout-card,
.download-group,
.admin-panel,
.install-panel,
.auth-card,
.empty-state {
    padding: 18px;
}

.download-group {
    display: grid;
    gap: 8px;
    align-content: start;
}

.download-group a {
    padding: 10px 0;
    border-top: 1px solid var(--line);
    color: var(--blue);
    font-weight: 700;
}

.auth-page,
.install-page {
    display: grid;
    min-height: calc(100vh - 80px);
    place-items: start center;
}

.auth-card,
.install-shell {
    width: min(720px, 100%);
}

.install-shell {
    padding: 24px 16px;
}

.install-form,
.stack-form {
    margin-top: 16px;
}

.notice,
.flash {
    width: min(1120px, calc(100% - 32px));
    margin: 14px auto;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.success {
    background: #e9f8f0;
    color: var(--green);
}

.danger {
    background: #fff0ed;
    color: var(--red);
}

.warning {
    background: #fff8e8;
    color: var(--amber);
}

.site-footer {
    display: grid;
    gap: 12px;
    padding: 28px 0;
    border-top: 1px solid var(--line);
}

.site-footer div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.admin-nav a {
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 800;
}

.metric-grid {
    margin-bottom: 16px;
}

.metric-grid div {
    display: grid;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.metric-grid span {
    color: var(--muted);
    font-weight: 700;
}

.metric-grid strong {
    font-size: 26px;
}

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

.check-control input {
    width: auto;
    min-height: auto;
}

@media (min-width: 720px) {
    .nav-toggle {
        display: none;
    }

    .site-nav {
        position: static;
        display: flex;
        align-items: center;
        width: auto;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .site-nav a {
        padding: 8px 10px;
    }

    .hero,
    .product-detail,
    .checkout-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
        align-items: center;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-bar {
        grid-template-columns: 1fr 220px 190px auto;
    }

    .cart-row,
    .table-row {
        grid-template-columns: minmax(0, 1fr) 110px 120px auto;
    }

    .download-grid,
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .download-band,
    .site-footer {
        grid-template-columns: 1fr auto;
        align-items: center;
    }
}

@media (min-width: 1020px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .download-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metric-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
