:root {
    --ink: #17201a;
    --muted: #657169;
    --line: #dce5df;
    --paper: #f8faf6;
    --panel: #ffffff;
    --accent: #0b7a75;
    --accent-dark: #075853;
    --warm: #f0b429;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

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

body.has-custom-bg {
    background-image:
        linear-gradient(rgba(248, 250, 246, .82), rgba(248, 250, 246, .82)),
        var(--site-bg-image);
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 14px 6vw;
    background: rgba(248, 250, 246, .96);
    border-bottom: 1px solid var(--line);
}

.topbar nav {
    min-width: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent-dark);
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
}

.search {
    display: flex;
    min-width: 0;
}

.search input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: 6px 0 0 6px;
    padding: 11px 12px;
}

.search button,
button,
.button {
    border: 0;
    border-radius: 6px;
    padding: 11px 15px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.disabled-button,
button:disabled {
    background: #94a3a0;
    cursor: not-allowed;
}

.danger-button {
    background: var(--danger);
}

.search button {
    border-radius: 0 6px 6px 0;
}

nav {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.shop-layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.category-tree {
    position: sticky;
    top: 86px;
}

.category-tree h2 {
    margin: 0 0 14px;
    font-size: 22px;
}

.category-tree a,
.category-tree summary,
.category-tree .sub-link {
    display: block;
    border-radius: 6px;
    padding: 9px 10px;
    color: var(--ink);
    font-weight: 700;
}

.category-tree summary {
    cursor: pointer;
    list-style: none;
}

.category-tree summary::-webkit-details-marker {
    display: none;
}

.category-tree .sub-link {
    margin-left: 14px;
    color: var(--muted);
    font-size: 14px;
}

.category-tree a.active,
.category-tree .sub-link.active {
    background: var(--accent);
    color: #fff;
}

.compact-tree {
    position: static;
}

main {
    width: min(1180px, 88vw);
    margin: 0 auto;
    padding: 34px 0 60px;
}

.hero {
    min-height: 430px;
    display: flex;
    align-items: center;
    padding: 56px;
    color: #fff;
    background:
        linear-gradient(90deg, rgba(7, 36, 34, .86), rgba(7, 36, 34, .22)),
        url('https://images.unsplash.com/photo-1518770660439-4636190af475?auto=format&fit=crop&w=1800&q=85') center/cover;
    border-radius: 8px;
}

.hero div {
    max-width: 660px;
}

.hero h1 {
    margin: 8px 0 16px;
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1.02;
}

.hero p {
    font-size: 18px;
    line-height: 1.6;
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 12px;
    font-weight: 800;
    color: var(--warm);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 18px 0 34px;
}

.metrics div,
.panel,
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics div {
    padding: 20px;
}

.metrics strong {
    display: block;
    font-size: 28px;
}

.metrics span,
.card p,
small,
.summary-row {
    color: var(--muted);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 22px;
}

.section-head h2,
.panel h1 {
    margin: 5px 0 0;
    font-size: 32px;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filters a,
.pill {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 10px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.filters a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

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

.card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.card h3 {
    margin: 0;
    font-size: 20px;
}

.card p {
    line-height: 1.5;
    margin: 0;
}

.card-bottom {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.card-bottom strong,
.price,
.summary-total {
    color: var(--accent-dark);
    font-weight: 800;
}

.product-detail {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 36px;
    align-items: start;
}

.product-detail img {
    width: 100%;
    border-radius: 8px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.product-detail h1 {
    margin: 12px 0;
    font-size: 42px;
}

.product-detail p {
    color: var(--muted);
    line-height: 1.7;
}

.text-link {
    color: var(--accent-dark);
    font-weight: 800;
    text-decoration: underline;
}

.rich-description {
    color: var(--muted);
    line-height: 1.7;
}

.rich-description img,
.rich-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--line);
    margin: 10px 0;
}

.rich-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    color: var(--ink);
}

.rich-description a {
    color: var(--accent-dark);
    font-weight: 800;
    text-decoration: underline;
}

.price {
    font-size: 34px;
    margin: 20px 0;
}

.buy-row {
    display: flex;
    gap: 10px;
}

.buy-row input,
.qty {
    width: 82px;
}

.panel {
    padding: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.rich-editor {
    min-height: 260px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
    line-height: 1.6;
    outline: none;
    margin-bottom: 10px;
    overflow: auto;
}

.rich-editor:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(11, 122, 117, .12);
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 14px;
}

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

.checkout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
}

.company-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
}

.company-logo-large {
    max-width: 180px;
    max-height: 110px;
    object-fit: contain;
    margin-bottom: 16px;
}

.lead {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.6;
}

.contact-panel p {
    color: var(--muted);
    line-height: 1.55;
}

.contact-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.secondary-button {
    background: #315f9d;
}

.google-button {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    background: #ffffff;
    color: #1f2937;
    border: 1px solid var(--line);
}

.login-suggest {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
    background: #fbfcfa;
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: auto;
}

.smtp-test-form {
    margin-top: 20px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.inline-import {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.hint {
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 0;
}

.product-pdf {
    margin-top: 18px;
}

.product-pdf iframe {
    width: 100%;
    min-height: 640px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.article-page {
    max-width: 920px;
    margin: 0 auto;
}

.article-page h1 {
    font-size: 42px;
    margin: 8px 0 18px;
}

.article-cover {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
    border-radius: 8px;
    margin: 12px 0 22px;
}

.media-frame {
    margin-top: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.media-frame iframe,
.media-frame video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

.pdf-viewer {
    margin-top: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.pdf-viewer iframe {
    display: block;
    width: 100%;
    min-height: 720px;
    border: 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.summary-total {
    font-size: 22px;
    margin-top: 16px;
}

.auth {
    width: min(460px, 100%);
    margin: 0 auto;
}

.center {
    text-align: center;
}

.flash {
    width: min(1180px, 88vw);
    margin: 18px auto 0;
    padding: 13px 16px;
    border-radius: 6px;
    background: #e8f6ef;
    color: #12543c;
    font-weight: 700;
}

.flash.error {
    background: #fdecec;
    color: var(--danger);
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.admin-tabs a,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 9px 12px;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 14px;
    font-weight: 700;
}

.admin-tabs a.active,
.small-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.logo-preview {
    max-width: 160px;
    max-height: 90px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    margin-bottom: 14px;
}

.order-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 12px;
    padding: 14px 16px;
    background: #fff;
}

.order-card summary {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 14px;
    align-items: center;
    cursor: pointer;
}

.order-items {
    display: grid;
    gap: 10px;
    padding: 0;
    margin: 14px 0 0;
    list-style: none;
}

.order-items li {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.order-items.compact {
    margin: 0;
    font-size: 13px;
}

.order-items.compact li {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
}

.status-pill {
    border-radius: 999px;
    padding: 8px 12px;
    background: #e8f6ef;
    color: #12543c;
    font-weight: 800;
}

.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 7px 10px;
    background: #e8f6ef;
    color: #12543c;
    font-size: 13px;
    font-weight: 800;
}

.stock-badge.low {
    background: #fff6db;
    color: #8a5b00;
}

.stock-badge.out {
    background: #fdecec;
    color: var(--danger);
}

.order-detail {
    margin-top: 18px;
}

.order-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.order-meta div {
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfa;
}

.order-meta span {
    color: var(--muted);
    line-height: 1.45;
}

footer {
    display: grid;
    grid-template-columns: minmax(260px, 1.2fr) .7fr minmax(260px, 1fr);
    gap: 28px;
    padding: 34px 6vw;
    border-top: 1px solid var(--line);
    background: #eef5f0;
    color: var(--muted);
}

.footer-brand,
.footer-links,
.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.footer-brand {
    flex-direction: row;
    align-items: flex-start;
}

.footer-brand img {
    width: 54px;
    height: 54px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 6px;
    border: 1px solid var(--line);
}

.bg-preview {
    width: 100%;
    max-width: 420px;
    height: 150px;
    object-fit: cover;
}

.footer-brand strong,
.footer-links strong,
.footer-contact strong {
    color: var(--ink);
    font-size: 17px;
}

.footer-contact {
    align-items: flex-start;
}

.footer-contact a,
.footer-links a {
    color: var(--accent-dark);
    font-weight: 800;
}

.social-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.social-row a {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 11px;
    background: #fff;
}

@media (max-width: 820px) {
    body {
        font-size: 15px;
    }

    .topbar {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px 5vw;
        position: static;
    }

    .brand {
        font-size: 20px;
        max-width: 100%;
    }

    .brand span {
        overflow-wrap: anywhere;
    }

    .search {
        width: 100%;
    }

    nav,
    .section-head,
    .cart-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
        justify-content: stretch;
    }

    nav a {
        border: 1px solid var(--line);
        border-radius: 6px;
        padding: 9px 10px;
        background: #fff;
        text-align: center;
    }

    .hero {
        padding: 34px 24px;
        min-height: 360px;
    }

    .hero h1 {
        font-size: 38px;
        line-height: 1.08;
    }

    .metrics,
    .grid,
    .shop-layout,
    .product-detail,
    .checkout,
    .company-page,
    .inline-import,
    .order-meta {
        grid-template-columns: 1fr;
    }

    .order-card summary {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .footer-contact {
        align-items: flex-start;
    }

    .category-tree {
        position: static;
    }

    footer {
        grid-template-columns: 1fr;
    }

    .footer-brand {
        flex-direction: column;
    }
}

@media (max-width: 540px) {
    main {
        width: min(100% - 24px, 1180px);
        padding: 22px 0 44px;
    }

    .topbar {
        padding: 10px 12px;
    }

    .brand img {
        width: 36px;
        height: 36px;
    }

    .search input {
        padding: 10px;
    }

    .search button,
    button,
    .button {
        width: auto;
        min-height: 42px;
        padding: 10px 12px;
    }

    nav {
        font-size: 13px;
    }

    .hero {
        border-radius: 0;
        margin-inline: -12px;
        padding: 30px 18px;
    }

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

    .hero p {
        font-size: 16px;
    }

    .section-head h2,
    .panel h1 {
        font-size: 26px;
    }

    .panel {
        padding: 18px;
    }

    .card-bottom,
    .buy-row,
    .contact-buttons,
    .inline-form,
    .inline-import,
    .social-row {
        align-items: stretch;
        flex-direction: column;
    }

    .card-bottom form,
    .card-bottom button,
    .buy-row input,
    .buy-row button,
    .contact-buttons a,
    .inline-import button {
        width: 100%;
    }

    .product-detail h1 {
        font-size: 30px;
    }

    .price {
        font-size: 28px;
    }

    .order-items li,
    .order-items.compact li {
        grid-template-columns: 1fr;
        display: grid;
    }

    footer {
        padding: 28px 18px;
    }
}
