.kc-calculator,
.kc-calculator * {
    box-sizing: border-box;
}

.kc-calculator {
    width: 100%;
    max-width: 1120px;
    margin: 24px auto;
    padding: 24px;
    border-radius: 24px;
    background: #fffdf8;
    border: 1px solid #f1e4cf;
    color: #2b2118;
    font-family: inherit;
    box-shadow: 0 18px 45px rgba(90, 61, 31, 0.1);
}

.kc-header {
    margin-bottom: 18px;
}

.kc-eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #a16424;
}

.kc-header h2 {
    margin: 0 0 8px;
    font-size: clamp(24px, 4vw, 36px);
    line-height: 1.12;
    color: #24180f;
}

.kc-header p,
.kc-help p {
    margin: 0;
    color: #6a5848;
    line-height: 1.55;
}

.kc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .8fr);
    gap: 18px;
    align-items: start;
}

.kc-panel {
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid #f0dfc8;
    padding: 18px;
}

.kc-section + .kc-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3e8d8;
}

.kc-section h3,
.kc-result-panel h3,
.kc-help h3 {
    margin: 0 0 12px;
    font-size: 18px;
    line-height: 1.25;
    color: #342315;
}

.kc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.kc-field-full {
    width: 100%;
}

.kc-field span,
.kc-choice span {
    font-size: 14px;
    font-weight: 700;
    color: #4b3828;
}

.kc-field input,
.kc-field select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d9c5ad;
    border-radius: 14px;
    padding: 10px 12px;
    font: inherit;
    color: #2b2118;
    background: #fffaf3;
    outline: none;
}

.kc-field input:focus,
.kc-field select:focus {
    border-color: #b77731;
    box-shadow: 0 0 0 3px rgba(183, 119, 49, 0.14);
}

.kc-product-search {
    position: relative;
    width: 100%;
}

.kc-product-search input[data-kc="product"] {
    padding-right: 44px;
}

.kc-product-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: #eadcc9;
    color: #5c4129;
    cursor: pointer;
    font: inherit;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    transition: background .15s ease, color .15s ease, opacity .15s ease;
}

.kc-product-clear:hover,
.kc-product-clear:focus-visible {
    background: #b77731;
    color: #ffffff;
    outline: none;
}

.kc-product-clear[hidden] {
    display: none !important;
}

.kc-product-suggestions[hidden] {
    display: none !important;
}

.kc-product-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 270px;
    overflow-y: auto;
    border: 1px solid #d9c5ad;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 14px 32px rgba(70, 45, 21, 0.16);
    padding: 6px;
}

.kc-product-suggestion {
    width: 100%;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #2b2118;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    text-align: left;
    font: inherit;
}

.kc-product-suggestion:hover,
.kc-product-suggestion.is-active {
    background: #fff3df;
}

.kc-product-suggestion-name {
    min-width: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    color: #2b2118;
}

.kc-product-suggestion-density {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    color: #8a633d;
}

.kc-product-suggestion-empty {
    padding: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #796656;
}

.kc-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.kc-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.kc-choice label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid #eadcc9;
    border-radius: 14px;
    background: #fffaf3;
    padding: 10px 12px;
    cursor: pointer;
}

.kc-choice input {
    accent-color: #b77731;
}

.kc-product-info,
.kc-note {
    margin-top: 8px;
    font-size: 13px;
    color: #796656;
    line-height: 1.45;
}

.kc-density-field {
    margin-top: 12px;
}

.kc-result-panel {
    position: sticky;
    top: 16px;
    background: linear-gradient(180deg, #fff8ee, #ffffff);
}

.kc-result-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    margin: 8px 0 8px;
    padding: 18px;
    border-radius: 18px;
    background: #3a2617;
    color: #ffffff;
    font-size: clamp(21px, 3.4vw, 32px);
    line-height: 1.18;
    font-weight: 800;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    overflow-x: hidden;
}

.kc-result-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 .25em;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.kc-result-number,
.kc-result-unit,
.kc-result-equals {
    display: inline-block;
    max-width: 100%;
}

.kc-result-number,
.kc-result-equals {
    white-space: nowrap;
}

.kc-result-unit {
    overflow-wrap: anywhere;
    word-break: normal;
}

.kc-nowrap {
    white-space: nowrap;
}

.kc-result-sub {
    color: #6a5848;
    line-height: 1.5;
    font-size: 14px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.kc-breakdown {
    display: grid;
    gap: 10px;
    margin: 16px 0;
}

.kc-breakdown div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
    background: #fffaf3;
    border: 1px solid #f1e4cf;
}

.kc-breakdown span {
    color: #7c6a59;
    font-size: 13px;
}

.kc-breakdown strong {
    color: #2f2117;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    line-height: 1.35;
}

.kc-breakdown strong[data-kc="summaryProduct"] {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.kc-breakdown strong:not([data-kc="summaryProduct"]) {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

.kc-copy {
    width: 100%;
    min-height: 46px;
    border: none;
    border-radius: 15px;
    background: #b77731;
    color: #ffffff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease;
}

.kc-copy:hover {
    transform: translateY(-1px);
    opacity: .95;
}

.kc-help {
    margin-top: 18px;
    padding: 18px;
    border-radius: 20px;
    background: #fff7ec;
    border: 1px solid #f1e4cf;
}

.kc-help p + p {
    margin-top: 8px;
}

@media (max-width: 860px) {
    .kc-calculator {
        padding: 16px;
        border-radius: 20px;
    }

    .kc-layout {
        grid-template-columns: 1fr;
    }

    .kc-result-panel {
        position: static;
    }
}

@media (max-width: 520px) {
    .kc-calculator {
        margin: 16px auto;
        padding: 12px;
    }

    .kc-panel,
    .kc-help {
        padding: 14px;
        border-radius: 18px;
    }

    .kc-grid-2 {
        grid-template-columns: 1fr;
    }

    .kc-choice {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .kc-choice label {
        padding: 9px 8px;
    }

    .kc-field span,
    .kc-choice span {
        font-size: 13px;
    }

    .kc-result-main {
        padding: 14px;
    }

    .kc-breakdown div {
        flex-direction: column;
        gap: 4px;
    }

    .kc-breakdown strong {
        text-align: left;
    }
}
