:root {
    --ds-red: #c62828;
    --ds-red-dark: #9f1f1f;
    --ds-yellow: #f5b83d;
    --ds-green: #157f3b;
    --ds-ink: #202a35;
    --ds-muted: #687586;
    --ds-line: #dfe5ec;
    --ds-soft-line: #eef2f6;
    --ds-bg: #f5f7fa;
    --ds-surface: #ffffff;
    --ds-shadow: 0 16px 36px rgba(29, 38, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ds-ink);
    background: var(--ds-bg);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
    overflow-x: hidden;
}

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

a {
    color: var(--ds-red);
    text-decoration: none;
}

a:hover {
    color: var(--ds-red-dark);
}

code {
    padding: 2px 6px;
    border-radius: 5px;
    background: #f0f3f7;
    color: #435063;
    font-size: 13px;
}

.container {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    background: var(--ds-surface);
    border-bottom: 1px solid var(--ds-line);
}

.topbar__inner,
.nav__inner {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ds-ink);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.topbar__contacts {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--ds-muted);
    font-size: 14px;
}

.topbar__contacts a {
    color: var(--ds-ink);
    font-weight: 700;
}

.nav {
    background: var(--ds-red);
}

.nav__links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nav a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

main.container {
    padding: 28px 0 54px;
}

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

.flash {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--ds-line);
    border-left: 4px solid var(--ds-red);
    border-radius: 8px;
    background: var(--ds-surface);
    color: var(--ds-ink);
}

.flash--success {
    border-left-color: var(--ds-green);
}

.flash--error {
    border-left-color: var(--ds-red);
}

.panel,
.section-block {
    margin: 0 0 24px;
    padding: 26px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.panel h1,
.section-block h1,
.section-block h2 {
    margin: 0 0 8px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 17px;
    border: 1px solid var(--ds-red);
    border-radius: 6px;
    background: var(--ds-red);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.button:hover {
    background: var(--ds-red-dark);
    border-color: var(--ds-red-dark);
    color: #fff;
}

.button--ghost {
    background: #fff;
    color: var(--ds-red);
}

.button--ghost:hover {
    background: #fff6f6;
    color: var(--ds-red-dark);
}

.button--small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--ds-red);
    padding: 0;
    font: inherit;
    cursor: pointer;
}

.link-button.danger {
    color: #a41616;
}

.hero {
    min-height: 430px;
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 42px;
    overflow: hidden;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.hero__content {
    min-width: 0;
}

.hero h1 {
    max-width: 620px;
    margin: 0 0 18px;
    font-size: 42px;
    line-height: 1.08;
}

.hero p {
    max-width: 590px;
    margin: 0 0 24px;
    color: var(--ds-muted);
    font-size: 18px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero__visual {
    align-self: stretch;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero__visual img {
    width: 100%;
    height: 100%;
    max-height: 430px;
    object-fit: contain;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.section-head h1,
.section-head h2 {
    margin: 0 0 6px;
}

.category-grid,
.product-grid,
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.category-card,
.product-card,
.stat-card,
.category-row {
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.category-card {
    min-height: 108px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    color: var(--ds-ink);
}

.category-card img,
.category-card__icon {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    border-radius: 8px;
    object-fit: cover;
    background: #f1f4f8;
}

.category-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-red);
    font-weight: 800;
}

.category-card strong,
.category-card small {
    display: block;
}

.category-card small {
    margin-top: 4px;
    color: var(--ds-muted);
}

.category-list {
    display: grid;
    gap: 10px;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    color: var(--ds-ink);
}

.category-row small {
    display: block;
    margin-top: 3px;
    color: var(--ds-muted);
}

.product-card {
    min-height: 100%;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

.product-card__image {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f5f8;
    color: var(--ds-red);
    font-weight: 800;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}

.product-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.product-card__title {
    color: var(--ds-ink);
    font-weight: 800;
}

.product-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 22px;
}

.filter-panel {
    align-self: start;
    padding: 20px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.filter-panel h2 {
    margin: 12px 0 16px;
}

.filter-panel form,
.form-stack {
    display: grid;
    gap: 14px;
}

.filter-panel label,
.form-stack label,
.form-main label,
.form-side label,
.property-grid label {
    display: grid;
    gap: 7px;
    color: #3b4654;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cfd7e1;
    border-radius: 6px;
    background: #fff;
    color: var(--ds-ink);
    font: 14px Arial, Helvetica, sans-serif;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(198, 40, 40, 0.18);
    border-color: var(--ds-red);
}

.category-hero {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    padding: 24px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.category-hero h1 {
    margin: 0 0 8px;
}

.category-hero p {
    max-width: 680px;
    margin: 0;
    color: var(--ds-muted);
}

.category-hero img {
    width: 180px;
    height: 130px;
    object-fit: contain;
}

.subcategories {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 18px;
}

.subcategories a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--ds-line);
    border-radius: 6px;
    background: #fff;
    color: var(--ds-ink);
    font-weight: 700;
}

.subcategories span {
    color: var(--ds-muted);
    font-weight: 400;
}

.seo-text {
    margin-top: 22px;
    padding: 24px;
    background: #fff;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    color: #485465;
}

.product-page {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.product-gallery,
.product-info,
.product-details {
    padding: 24px;
    background: #fff;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.product-gallery__main,
.product-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border: 1px solid var(--ds-soft-line);
    border-radius: 8px;
    background: #f3f6f9;
}

.product-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-red);
    font-size: 28px;
    font-weight: 800;
}

.product-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.product-gallery__thumbs img {
    aspect-ratio: 1;
    object-fit: contain;
    padding: 6px;
    border: 1px solid var(--ds-soft-line);
    border-radius: 6px;
    background: #f7f9fb;
    cursor: pointer;
}

.product-info h1 {
    margin: 10px 0 10px;
    font-size: 34px;
    line-height: 1.15;
}

.product-buy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 24px 0 12px;
    padding: 18px;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.product-buy form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-input {
    width: 82px;
}

.price {
    color: var(--ds-ink);
    font-size: 30px;
    font-weight: 800;
}

.old-price {
    color: var(--ds-muted);
    text-decoration: line-through;
}

.stock-status {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 6px;
    background: #edf8f1;
    color: var(--ds-green);
    font-weight: 700;
}

.tabs {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr) minmax(220px, 0.6fr);
    gap: 24px;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
}

.spec-table th,
.spec-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--ds-soft-line);
    text-align: left;
    vertical-align: top;
}

.spec-table th {
    width: 45%;
    color: var(--ds-muted);
    font-weight: 700;
}

.doc-link {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--ds-soft-line);
}

.back-link,
.reset-link {
    font-size: 14px;
    font-weight: 700;
}

.empty-state,
.notice {
    padding: 18px;
    border: 1px dashed #cbd4df;
    border-radius: 8px;
    background: #fbfcfe;
    color: var(--ds-muted);
}

.admin-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
}

.account-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 24px;
}

.admin-sidebar,
.account-sidebar {
    align-self: start;
    padding-right: 18px;
    border-right: 1px solid var(--ds-line);
}

.admin-sidebar__title,
.account-sidebar__title {
    margin-bottom: 10px;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-menu,
.account-menu {
    display: grid;
    gap: 5px;
}

.admin-menu a,
.account-menu a {
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--ds-ink);
    font-weight: 700;
}

.admin-menu a:hover,
.account-menu a:hover {
    background: #f1f4f8;
    color: var(--ds-red);
}

.admin-logout,
.account-logout {
    margin-top: 18px;
}

.account-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(300px, 1.05fr);
    gap: 18px;
    margin-bottom: 20px;
}

.account-card,
.company-card {
    padding: 18px;
    background: #fff;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.account-card h2,
.company-card h2 {
    margin: 0 0 12px;
}

.section-head--compact {
    align-items: center;
    margin-bottom: 14px;
}

.company-list {
    display: grid;
    gap: 10px;
}

.company-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--ds-soft-line);
    border-radius: 8px;
    color: var(--ds-ink);
}

.company-item span {
    color: var(--ds-muted);
    font-size: 13px;
}

.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.company-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.company-card__head span {
    padding: 5px 8px;
    border-radius: 6px;
    background: #edf8f1;
    color: var(--ds-green);
    font-size: 12px;
    font-weight: 800;
}

.company-card dl {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 8px 12px;
    margin: 12px 0 16px;
}

.company-card dt {
    color: var(--ds-muted);
    font-weight: 700;
}

.company-card dd {
    margin: 0;
}

.auth-note {
    margin: 18px 0 0;
    color: var(--ds-muted);
}

.stat-card {
    display: grid;
    gap: 6px;
    padding: 18px;
    color: var(--ds-ink);
}

.stat-card span {
    font-size: 34px;
    font-weight: 800;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--ds-soft-line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: #f7f9fb;
    color: #4a5666;
    font-size: 12px;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    white-space: nowrap;
}

.row-actions form {
    display: inline;
}

.table-thumb,
.admin-thumb {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border: 1px solid var(--ds-line);
    border-radius: 6px;
    background: #f3f6f9;
}

.table-thumb--empty {
    display: inline-block;
}

.filters {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px) auto;
    gap: 10px;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
}

.form-grid--narrow {
    grid-template-columns: minmax(0, 720px) 260px;
}

.form-main,
.form-side {
    display: grid;
    align-content: start;
    gap: 16px;
}

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.check-row {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 700;
}

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

.check-row--inside {
    color: var(--ds-ink);
    font-size: 14px;
    font-weight: 400;
}

.field-group {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    background: #fbfcfe;
}

.field-group__title {
    font-weight: 800;
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.checkbox-list {
    display: grid;
    gap: 7px;
}

.media-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.media-item {
    gap: 6px !important;
    font-size: 12px !important;
}

.media-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 1px solid var(--ds-line);
    border-radius: 6px;
}

.doc-list {
    display: grid;
    gap: 8px;
}

.auth-panel {
    min-height: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(430px, 100%);
    padding: 28px;
    background: #fff;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    box-shadow: var(--ds-shadow);
}

.auth-card h1 {
    margin: 0 0 8px;
}

.cart-list {
    display: grid;
    gap: 12px;
}

.cart-row {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 110px 150px;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
}

.cart-row__image {
    width: 82px;
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f2f5f8;
    color: var(--ds-red);
    font-weight: 800;
}

.cart-row__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cart-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.checkout-layout,
.order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--ds-soft-line);
}

.checkout-total {
    margin-top: 16px;
    font-size: 28px;
    font-weight: 800;
}

.order-card {
    padding: 18px;
    border: 1px solid var(--ds-line);
    border-radius: 8px;
    background: #fbfcfe;
}

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

@media (max-width: 980px) {
    .hero,
    .catalog-layout,
    .product-page,
    .tabs,
    .checkout-layout,
    .order-layout,
    .form-grid,
    .form-grid--narrow {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 28px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .admin-shell {
        grid-template-columns: 1fr;
    }

    .account-shell,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .admin-sidebar,
    .account-sidebar {
        padding-right: 0;
        padding-bottom: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--ds-line);
    }
}

@media (max-width: 720px) {
    .container {
        width: calc(100% - 24px);
        max-width: 1220px;
    }

    .topbar__inner,
    .nav__inner {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 0;
    }

    .topbar__contacts,
    .section-head,
    .product-buy,
    .cart-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .nav__links {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
    }

    .nav a {
        justify-content: center;
        min-height: 36px;
        padding: 0 10px;
        font-size: 13px;
        text-align: center;
        white-space: normal;
    }

    .hero {
        min-height: auto;
        display: flex;
        flex-direction: column;
        padding: 18px;
    }

    .hero h1 {
        width: 100%;
        max-width: 100%;
        font-size: 23px;
        line-height: 1.16;
        overflow-wrap: break-word;
    }

    .hero p {
        width: 100%;
        max-width: 100%;
        font-size: 16px;
        overflow-wrap: break-word;
    }

    .hero__content,
    .hero__visual {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .hero__visual {
        min-height: 240px;
    }

    .hero__visual img {
        width: min(100%, 320px);
        height: auto;
    }

    .hero__actions {
        display: grid;
        width: 100%;
        grid-template-columns: 1fr;
    }

    .hero__actions .button {
        width: 100%;
        min-height: 44px;
    }

    .panel,
    .section-block,
    .product-gallery,
    .product-info,
    .product-details {
        padding: 18px;
    }

    .split,
    .property-grid,
    .filters {
        grid-template-columns: 1fr;
    }

    .row-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .cart-row {
        grid-template-columns: 70px minmax(0, 1fr);
    }

    .cart-row input,
    .cart-row strong {
        grid-column: 2;
    }
}
