.cnt-app {
    --cnt-border: #cbd5e1;
    --cnt-text: #111827;
    --cnt-muted: #64748b;
    --cnt-panel: #ffffff;
    --cnt-soft: #f8fafc;
    --cnt-accent: #0f766e;
    --cnt-accent-strong: #115e59;
    --cnt-warning: #b45309;
    color: var(--cnt-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

.cnt-app *,
.cnt-app *::before,
.cnt-app *::after {
    box-sizing: border-box;
}

.cnt-form {
    display: grid;
    gap: 16px;
}

.cnt-header,
.cnt-section-head,
.cnt-pattern-body {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.cnt-header h2,
.cnt-panel h3,
.cnt-pattern h4 {
    letter-spacing: 0;
    margin: 0;
}

.cnt-header h2 {
    font-size: clamp(1.35rem, 2vw, 1.9rem);
}

.cnt-header p,
.cnt-pattern p {
    color: var(--cnt-muted);
    margin: 4px 0 0;
}

.cnt-grid {
    display: grid;
    gap: 16px;
}

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

.cnt-panel,
.cnt-pattern {
    background: var(--cnt-panel);
    border: 1px solid var(--cnt-border);
    border-radius: 8px;
    padding: 16px;
}

.cnt-panel legend {
    font-weight: 700;
    padding: 0 6px;
}

.cnt-panel label {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}

.cnt-panel label span,
.cnt-products-table th,
.cnt-result-table th {
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
}

.cnt-app input[type="number"],
.cnt-app input[type="text"],
.cnt-app select {
    background: #ffffff;
    border: 1px solid var(--cnt-border);
    border-radius: 6px;
    color: var(--cnt-text);
    min-height: 40px;
    padding: 8px 10px;
    width: 100%;
}

.cnt-app input:focus,
.cnt-app select:focus {
    border-color: var(--cnt-accent);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
    outline: none;
}

.cnt-check,
.cnt-mini-check {
    align-items: center;
    display: flex !important;
    gap: 8px !important;
}

.cnt-check input,
.cnt-mini-check input {
    height: 18px;
    width: 18px;
}

.cnt-button,
.cnt-icon-button {
    align-items: center;
    border: 1px solid var(--cnt-border);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 38px;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.cnt-button {
    background: var(--cnt-accent);
    color: #ffffff;
    padding: 8px 12px;
}

.cnt-button:hover {
    background: var(--cnt-accent-strong);
}

.cnt-button-secondary {
    background: #ffffff;
    color: var(--cnt-accent-strong);
}

.cnt-button-secondary:hover {
    background: #ecfeff;
    border-color: var(--cnt-accent);
}

.cnt-icon-button {
    background: #fff7ed;
    color: #9a3412;
    font-size: 22px;
    height: 36px;
    line-height: 1;
    padding: 0;
    width: 36px;
}

.cnt-icon-button:hover {
    background: #ffedd5;
    border-color: #fdba74;
}

.cnt-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.cnt-products-table,
.cnt-result-table {
    border-collapse: collapse;
    min-width: 720px;
    width: 100%;
}

.cnt-products-table th,
.cnt-products-table td,
.cnt-result-table th,
.cnt-result-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 8px;
    text-align: left;
    vertical-align: middle;
}

.cnt-products-table th:last-child,
.cnt-products-table td:last-child {
    text-align: right;
    width: 52px;
}

.cnt-output {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

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

.cnt-summary > div {
    background: var(--cnt-soft);
    border: 1px solid var(--cnt-border);
    border-radius: 8px;
    display: grid;
    gap: 2px;
    padding: 16px;
}

.cnt-summary span,
.cnt-summary em {
    color: var(--cnt-muted);
    font-style: normal;
}

.cnt-summary strong {
    color: var(--cnt-accent-strong);
    font-size: clamp(1.7rem, 4vw, 2.5rem);
    line-height: 1.05;
}

.cnt-pattern-list {
    display: grid;
    gap: 14px;
}

.cnt-pattern-body strong {
    background: #ecfeff;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    color: var(--cnt-accent-strong);
    padding: 6px 10px;
    white-space: nowrap;
}

.cnt-pattern-yield {
    color: #334155;
    font-weight: 700;
    margin: 0;
}

.cnt-pattern-tools {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin: 10px 0;
}

.cnt-layout-svg {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: block;
    height: auto;
    max-height: 420px;
    width: 100%;
}

.cnt-empty {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    padding: 14px 16px;
}

@media (max-width: 760px) {
    .cnt-grid-2,
    .cnt-summary {
        grid-template-columns: 1fr;
    }

    .cnt-header,
    .cnt-section-head,
    .cnt-pattern-body,
    .cnt-pattern-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .cnt-header .cnt-button,
    .cnt-section-head .cnt-button {
        width: 100%;
    }

    .cnt-products-table,
    .cnt-products-table thead,
    .cnt-products-table tbody,
    .cnt-products-table tr,
    .cnt-products-table th,
    .cnt-products-table td {
        display: block;
        min-width: 0;
        width: 100%;
    }

    .cnt-products-table thead {
        display: none;
    }

    .cnt-products-table tr {
        border: 1px solid var(--cnt-border);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 10px;
    }

    .cnt-products-table td {
        border: 0;
        padding: 7px 0;
    }

    .cnt-products-table td::before {
        color: #334155;
        content: attr(data-label);
        display: block;
        font-size: 0.78rem;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .cnt-products-table th:last-child,
    .cnt-products-table td:last-child {
        text-align: left;
        width: 100%;
    }
}
