:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1f2933;
    --muted: #617080;
    --line: #d9e0e7;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b42318;
    --warning: #a15c07;
    --ok: #15803d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
}

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

a:hover {
    text-decoration: underline;
}

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

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

.header-inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    color: var(--text);
    font-weight: 700;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
}

.main {
    padding: 32px 0 48px;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 18px 0;
    color: var(--muted);
    font-size: 13px;
    background: var(--surface);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.footer-inner p {
    margin: 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 28px;
    align-items: center;
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1.25;
}

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

.hero-points,
.simple-list {
    padding-left: 18px;
}

.cta-row,
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.button,
button,
input[type="submit"] {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 8px 14px;
    color: #fff;
    background: var(--primary);
    font: inherit;
    cursor: pointer;
}

.button.secondary,
button.secondary {
    color: var(--primary-dark);
    background: #fff;
}

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

.button.disabled,
button:disabled {
    border-color: #b8c2cc;
    background: #b8c2cc;
    cursor: not-allowed;
}

.section {
    margin-top: 32px;
}

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

.catalog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 24px;
    align-items: start;
}

.category-sidebar {
    position: sticky;
    top: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.category-sidebar h2 {
    margin-top: 0;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-list a {
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

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

.product-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: linear-gradient(135deg, #ffffff, #edf8f6);
    display: grid;
    place-items: center;
    color: var(--muted);
    overflow: hidden;
}

.product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    background: #e8f4f2;
    color: var(--primary-dark);
}

.badge.warning {
    background: #fff4df;
    color: var(--warning);
}

.badge.danger {
    background: #ffe6e2;
    color: var(--danger);
}

.badge.ok {
    background: #e8f7ee;
    color: var(--ok);
}

.price {
    font-weight: 700;
}

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

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
}

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

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

.error-text {
    color: var(--danger);
    font-size: 13px;
}

.alert {
    margin-bottom: 18px;
    border-radius: 6px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.alert.success {
    border-color: #9bd7b2;
    color: #0b5f2a;
}

.alert.error {
    border-color: #f0a29a;
    color: var(--danger);
}

.alert.warning {
    border-color: #f3c26b;
    color: var(--warning);
    background: #fff8e8;
}

.notice {
    border-left: 4px solid var(--warning);
    background: #fff8e8;
    padding: 10px 12px;
}

.notice.danger {
    border-left-color: var(--danger);
    background: #ffe6e2;
    color: var(--danger);
    font-weight: 700;
}

.small-note {
    color: var(--muted);
    font-size: 13px;
    margin: 12px 0 0;
}

.fee-alert {
    display: inline-flex;
    margin-left: 8px;
    border-radius: 999px;
    padding: 2px 8px;
    background: #fff4df;
    color: var(--warning);
    font-size: 12px;
    vertical-align: middle;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
}

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

th {
    background: #eef3f5;
    font-size: 13px;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.totals {
    width: min(420px, 100%);
    margin-left: auto;
}

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

.admin-header {
    border-top: 4px solid var(--primary);
}

@media (max-width: 760px) {
    .header-inner,
    .hero {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .category-sidebar {
        padding: 12px;
    }

    .category-sidebar h2 {
        font-size: 16px;
    }

    .category-list a {
        font-size: 12px;
        line-height: 1.45;
    }

    .header-inner {
        flex-direction: column;
        padding: 14px 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
    }
}
