@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

:root {
    color-scheme: light;
    --bg: #fbf9f8;
    --surface: #ffffff;
    --surface-soft: #f6f3f2;
    --surface-medium: #f0eded;
    --surface-strong: #e4e2e1;
    --text: #1b1c1c;
    --muted: #3d4949;
    --muted-soft: #6d7979;
    --line: #bcc9c8;
    --line-soft: #d7dddd;
    --brand: #006768;
    --brand-dark: #004f50;
    --brand-active: #008283;
    --accent: #ff8c00;
    --accent-dark: #904d00;
    --steel: #303030;
    --blue: #006a41;
    --shadow: none;
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, Arial, "Helvetica Neue", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
}

body {
    margin: 0;
    min-width: 320px;
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

[hidden] {
    display: none !important;
}

input,
button {
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--brand);
    border-radius: 4px;
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

button:hover,
.button:hover {
    background: var(--brand-dark);
    text-decoration: none;
}

.button.action,
button.action {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.button.action:hover,
button.action:hover {
    border-color: var(--accent-dark);
    background: var(--accent-dark);
}

.button.secondary {
    background: #fff;
    color: var(--brand);
}

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

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

.narrow {
    width: min(820px, calc(100% - 32px));
}

.section {
    padding: 32px 0;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
}

.section-head h2,
h1,
h2,
h3 {
    letter-spacing: 0;
}

h1 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
}

h2 {
    margin: 0 0 12px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 600;
}

h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 600;
}

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

.lead {
    font-size: 16px;
    color: var(--muted);
}

.notice {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-soft);
}

.account-panel {
    display: grid;
    gap: 12px;
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
}

.account-panel h2,
.account-panel p {
    margin: 0;
}

.account-panel p {
    color: var(--muted);
}

.checkout-form,
.checkout-summary {
    display: grid;
    gap: 16px;
}

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

.checkout-customer-section {
    display: grid;
    gap: 14px;
}

.checkout-customer-section[hidden] {
    display: none;
}

.checkout-fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
}

.checkout-fieldset legend {
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.checkout-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    font-weight: 700;
}

.checkout-option input {
    width: 16px;
    height: 16px;
    min-height: 0;
}

.cart-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line-soft);
}

.cart-heading p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.cart-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

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

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

.cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 42px 84px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
}

.cart-item-number {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 4px;
    background: var(--brand);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.cart-item-image {
    display: grid;
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 84px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: var(--surface-soft);
}

.cart-item-image img {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
}

.cart-item-main {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    gap: 5px;
    min-width: 0;
}

.cart-item-main strong {
    line-height: 1.32;
}

.cart-item-sku {
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

.cart-field {
    display: grid;
    gap: 5px;
}

.cart-field-qty {
    grid-column: 3;
    grid-row: 2;
}

.cart-field-price {
    grid-column: 3;
    grid-row: 3;
}

.cart-field-sum {
    grid-column: 3;
    grid-row: 4;
}

.cart-field-comment {
    grid-column: 3;
    grid-row: 5;
    max-width: 520px;
}

.cart-item > .button {
    grid-column: 4;
    grid-row: 1;
}

.cart-field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.cart-field strong {
    color: var(--brand-dark);
    font-size: 15px;
}

.cart-summary-panel,
.cart-empty-state {
    display: grid;
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
}

.cart-summary-panel {
    position: sticky;
    top: 84px;
}

.cart-summary-panel div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line-soft);
}

.cart-summary-panel span,
.cart-summary-panel p {
    color: var(--muted);
}

.cart-summary-panel p {
    margin: 0;
    line-height: 1.45;
}

.cart-summary-panel strong {
    color: var(--brand-dark);
    font-size: 30px;
}

.cart-summary-panel .button,
.cart-summary-panel button {
    width: 100%;
}

.cart-empty-state {
    max-width: 560px;
}

.cart-empty-state h2 {
    margin-bottom: 0;
}

.cart-empty-state p {
    margin: 0 0 6px;
    color: var(--muted);
}

.cart-qty {
    width: 88px;
}

.cart-comment {
    width: 100%;
}

.cart-order-comment {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
    font-weight: 700;
}

.cart-order-comment textarea {
    width: 100%;
    min-height: 92px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    resize: vertical;
}

.checkout-form label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.checkout-form .checkout-option {
    display: inline-flex;
    align-items: center;
}

.checkout-form label > span:has(+ :is(input, select, textarea)[required])::after {
    content: " *";
    color: var(--accent-dark);
}

.checkout-form input,
.checkout-form select,
.checkout-form textarea,
.cart-qty,
.cart-comment {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: #fff;
}

.checkout-form select {
    appearance: auto;
}

.checkout-form .checkout-option input {
    width: 16px;
    height: 16px;
    min-height: 0;
    padding: 0;
}

.checkout-form textarea {
    resize: vertical;
}

.checkout-summary {
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 4px;
    background: var(--surface-soft);
}

.checkout-summary h2 {
    margin-bottom: 0;
    font-size: 18px;
}

.checkout-summary-row {
    padding: 8px 0;
    border-top: 1px solid var(--line-soft);
}

.checkout-summary-total {
    color: var(--brand-dark);
    font-weight: 800;
}

@media (min-width: 1180px) {
    .cart-item {
        grid-template-columns: 42px 84px minmax(0, 1fr) 96px minmax(120px, 160px) minmax(120px, 160px) minmax(180px, 260px) auto;
        align-items: center;
    }

    .cart-item-image {
        grid-column: auto;
        grid-row: auto;
    }

    .cart-item-number,
    .cart-item-main {
        grid-column: auto;
        grid-row: auto;
    }

    .cart-field-qty,
    .cart-field-price,
    .cart-field-sum,
    .cart-field-comment,
    .cart-item > .button {
        grid-column: auto;
        grid-row: auto;
    }
}

@media (max-width: 760px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }

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

    .cart-summary-panel {
        position: static;
    }

    .cart-item {
        grid-template-columns: 42px 64px minmax(0, 1fr);
    }

    .cart-item-image {
        width: 64px;
    }

    .cart-item-image img {
        max-width: 54px;
        max-height: 54px;
    }

    .cart-field,
    .cart-item .button {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .cart-item-number {
        grid-column: 1;
        grid-row: 1;
    }

    .cart-item-image {
        grid-column: 2;
        grid-row: 1;
    }

    .cart-item-main {
        grid-column: 3;
        grid-row: 1;
    }

    .cart-field-qty {
        max-width: 120px;
    }

    .cart-field-comment {
        max-width: none;
    }
}

@media (max-width: 620px) {
    .cart-heading {
        display: grid;
    }

    .cart-heading .button {
        justify-self: stretch;
    }
}

.html-content {
    overflow-x: auto;
    line-height: 1.55;
}

.html-content table,
table {
    width: 100%;
    border-collapse: collapse;
}

.html-content th,
.html-content td,
th,
td {
    padding: 8px;
    border-bottom: 1px solid var(--line-soft);
    border-left: 0;
    border-right: 0;
    vertical-align: top;
}

thead th {
    position: sticky;
    top: 64px;
    z-index: 1;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.product-page thead th {
    position: static;
}

tbody tr:hover {
    background: rgba(0, 130, 131, .045);
}

.table-wrap {
    overflow-x: auto;
}

@media (max-width: 760px) {
    h1 {
        font-size: 30px;
    }

    .container,
    .narrow {
        width: min(100% - 24px, 1180px);
    }
}

/* ═══════════════════════════════════════
   Dark theme
   ═══════════════════════════════════════ */
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1a1a;
    --surface: #182626;
    --surface-soft: #1c2d2d;
    --surface-medium: #213535;
    --surface-strong: #273e3e;
    --text: #e4eeee;
    --muted: #8cb4b4;
    --muted-soft: #6d9898;
    --line: #2a4242;
    --line-soft: #1f3232;
    --brand: #00a0a2;
    --brand-dark: #00c2c4;
    --brand-active: #00b4b6;
    --accent: #ff9f1a;
    --accent-dark: #cc7d00;
}

[data-theme="dark"] .site-header {
    background: var(--surface);
    border-bottom-color: var(--line);
}

[data-theme="dark"] .menu-toggle,
[data-theme="dark"] .header-dropdown select {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

[data-theme="dark"] .header-search input,
[data-theme="dark"] .hero-search input,
[data-theme="dark"] .search-page-form input {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

[data-theme="dark"] .nav-catalog-menu {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 18px 48px rgba(0,0,0,.5);
}

[data-theme="dark"] .product-card,
[data-theme="dark"] .cart-item,
[data-theme="dark"] .stat {
    background: var(--surface);
}

[data-theme="dark"] .button.secondary {
    background: var(--surface);
    color: var(--brand);
}

[data-theme="dark"] .checkout-form input,
[data-theme="dark"] .checkout-form select,
[data-theme="dark"] .checkout-form textarea,
[data-theme="dark"] .cart-qty,
[data-theme="dark"] .cart-comment {
    background: var(--surface);
    color: var(--text);
    border-color: var(--line);
}

[data-theme="dark"] .checkout-summary {
    background: var(--surface-soft);
}

[data-theme="dark"] thead th {
    background: var(--surface-strong);
}

[data-theme="dark"] tbody tr:hover {
    background: rgba(0,160,162,.06);
}
