/* embed mode (iframe on stamp-service.ru) */
html.tamp-embed .back-link { display: none !important; }
html.tamp-embed .main.main--calculator { min-height: 0 !important; padding-top: 0.25rem; padding-bottom: 0.5rem; }
html.tamp-embed .embed-page-title {
    display: block;
    margin: 0.15rem 0 0.75rem;
    font-size: clamp(1.25rem, 2.2vw, 1.7rem);
    font-weight: 700;
    text-align: center;
    color: var(--text-color, #1a1a1a);
    line-height: 1.25;
}
/* без CSS sticky: iframe растёт по контенту, скролл у родителя — «прилипание» через JS */
html.tamp-embed .calculator-results {
    position: relative;
    top: auto !important;
    max-height: none;
    overflow: visible;
    z-index: 5;
    will-change: transform;
}
html.tamp-embed .calculator-results.is-embed-sticky {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
html.tamp-embed .calculator-wrapper {
    margin-top: 0.5rem;
    overflow: visible !important;
}

/* Клиентская оболочка: скрыть служебное; пояснения (размер/фальц/fit) остаются */
html.tamp-calc-client .calc-admin-only { display: none !important; }
html.tamp-calc-admin .calc-client-only { display: none !important; }

.calc-admin-badge {
    display: inline-block;
    margin-left: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    vertical-align: middle;
}
html.tamp-calc-admin .calc-admin-badge { display: inline-block; }
html.tamp-calc-client .calc-admin-badge { display: none !important; }

.calc-admin-panel-link {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.2rem 0.65rem;
    border-radius: var(--ui-radius-sm, 6px);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    color: #fff;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.45);
    vertical-align: middle;
    white-space: nowrap;
}
.calc-admin-panel-link:hover {
    background: rgba(255, 255, 255, 0.34);
    color: #fff;
}
html.tamp-calc-admin .calc-admin-panel-link { display: inline-block; }
html.tamp-calc-client .calc-admin-panel-link { display: none !important; }

.result-per-unit {
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: #555;
    text-align: right;
}

.special-package-luversi-host .param-row {
    margin-bottom: 0;
}
.special-package-luversi-host .checkbox-group-postpress {
    display: block;
}
.client-calc-summary {
    margin: 0 0 0.85rem;
    padding: 0 0 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #2a2a2a;
    font-size: 0.95rem;
    line-height: 1.45;
}
.client-calc-summary[hidden] { display: none !important; }
.client-calc-summary .ccs-title {
    margin: 0 0 0.55rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a1a1a;
}
.client-calc-summary .ccs-row {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    margin: 0.2rem 0;
    width: 100%;
}
.client-calc-summary .ccs-label {
    flex: 0 0 auto;
    white-space: nowrap;
}
.client-calc-summary .ccs-dots {
    flex: 1 1 auto;
    min-width: 0.5rem;
    border-bottom: 1px dotted #8a8a8a;
    transform: translateY(-0.28em);
    height: 0;
}
.client-calc-summary .ccs-value {
    flex: 0 1 auto;
    text-align: right;
    max-width: 65%;
}
/* Строка без метки (пакет / шубер / постпечать): слева, без переноса */
.client-calc-summary .ccs-row--plain {
    justify-content: flex-start;
}
.client-calc-summary .ccs-row--plain .ccs-value {
    flex: 0 1 auto;
    text-align: left;
    max-width: none;
    white-space: nowrap;
}
.client-calc-summary .ccs-section {
    margin: 0.65rem 0 0.2rem;
    font-weight: 700;
    color: #1a1a1a;
}
.client-calc-summary .ccs-subhead {
    margin: 0.45rem 0 0.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #444;
}
.client-calc-summary .ccs-muted { color: #777; }
.custom-stamp-disclaimer {
    margin: 0.35rem 0 0.45rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #664d03;
    background: #fff8e6;
    border-radius: var(--ui-radius-sm, 6px);
    border: 1px solid #f0d78c;
}
.custom-stamp-disclaimer[hidden] { display: none !important; }
html.tamp-calc-admin .client-calc-summary { display: none !important; }
html.tamp-calc-client #calculatorResultsHeading { display: none; }

.main.main--calculator {
    padding: 1.5rem 0;
    min-height: calc(100vh - 160px);
}

.back-link {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    font-size: 1rem;
    transition: opacity 0.3s;
}

.back-link:hover {
    opacity: 0.8;
}

.header-content {
    position: relative;
}

.calculator-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin-top: 0.25rem;
    opacity: 0.9;
}

.calculator-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem 1.25rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.calculator-params,
.calculator-results {
    background: var(--card-bg);
    border-radius: var(--ui-radius-lg, 12px);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    min-width: 0;
    max-width: 100%;
}

/* «Ваш расчет» / результаты всегда в зоне видимости при прокрутке параметров */
.calculator-results {
    position: sticky;
    top: 1rem;
    align-self: start;
    z-index: 5;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* embed: max-height / sticky — только через JS (см. html.tamp-embed выше) */

.calculator-params h3,
.calculator-results h3 {
    font-size: 1.35rem;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* Парные параметры в одной строке (левая колонка пополам) */
.param-row-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 0.5rem;
    margin-bottom: 0.75rem;
}
.param-row-pair .param-group {
    margin-bottom: 0;
}

/* Тип печати: все варианты в одну строку */
.radio-group-pair {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.2rem 0.5rem;
    align-items: start;
}

/* Цветность: все варианты в одну строку */
.radio-group-two-rows {
    display: block;
}
.radio-group-two-rows .param-row-pair {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    margin-bottom: 0;
    gap: 0.2rem 0.5rem;
    align-items: start;
}
.radio-group-two-rows .param-row-pair .radio-label {
    margin: 0;
}

.param-group {
    margin-bottom: 0.75rem;
}

.param-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--text-color);
}

.input-field,
.select-field {
    width: 100%;
    padding: 0.4rem 0.65rem;
    border: 2px solid var(--border-color);
    border-radius: var(--ui-radius-sm, 6px);
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.input-field.error,
.select-field.error {
    border-color: var(--accent-color);
    background-color: #fef5f5;
}

.quantity-row-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.quantity-row-wrap .input-field#quantity,
.quantity-row-wrap .input-field#pages,
.quantity-row-wrap .input-field#sheetsInBlock {
    flex: 0 1 auto;
    min-width: 4.25rem;
    max-width: 8.5rem;
    width: auto;
}

/* Многолистовой режим: поля sheet_N_pages и т.п. */
.param-section .quantity-row-wrap .input-field[type="number"] {
    flex: 0 1 auto;
    min-width: 4.25rem;
    max-width: 8.5rem;
    width: auto;
}

.quantity-quick-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    align-items: center;
    gap: 0.3rem;
    -webkit-overflow-scrolling: touch;
}

.quantity-quick-buttons[hidden] {
    display: none !important;
}

.quantity-quick-btn {
    padding: 0.28rem 0.55rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--ui-radius-sm, 6px);
    background: var(--card-bg, #f8f9fa);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.quantity-quick-btn:hover {
    background: var(--bg-hover, #eef1f4);
    border-color: var(--secondary-color);
}

.validation-errors {
    margin-top: 0.5rem;
    padding: 0.4rem 0.65rem;
    background: #fef5f5;
    border: 1px solid #f5c6cb;
    border-radius: var(--ui-radius-sm, 6px);
    color: #721c24;
    font-size: 0.9rem;
    list-style: none;
}

.validation-errors:empty {
    display: none;
}

.validation-errors ul {
    margin: 0;
    padding-left: 1rem;
}

.kbs-block-thickness-note.kbs-block-thickness-warn {
    padding: 0.4rem 0.55rem;
    background: #fff8e6;
    border: 1px solid #e6c200;
    border-radius: var(--ui-radius-sm, 6px);
    color: #5c4a00;
    line-height: 1.45;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Тип печати: одна строка */
.radio-group.radio-group-pair {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    flex-direction: unset;
}

.checkbox-group .param-row {
    display: block;
}

/* Постпечатные операции: две колонки; чекбокс и поля ввода — в одной колонке друг под другом */
.checkbox-group-postpress {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.85rem;
    align-items: start;
}
.checkbox-group-postpress .param-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    margin-bottom: 0;
    min-width: 0;
}
.checkbox-group-postpress .param-row .checkbox-label {
    min-width: 0;
    align-self: flex-start;
    width: 100%;
}
.checkbox-group-postpress .param-row .sub-options {
    margin-left: 0;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Секции листов с названиями (как в notebook: Обложка, Блок) */
.dynamic-sheets .param-section {
    margin: 0.75rem 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}
.dynamic-sheets .param-section:last-of-type {
    border-bottom: none;
}
.dynamic-sheets .param-section h4 {
    font-size: 1.05rem;
    color: var(--primary-color, #2c3e50);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color, #eee);
}
.dynamic-sheets .param-section .param-group {
    margin-bottom: 0.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.3rem 0.45rem;
    border-radius: var(--ui-radius-sm, 6px);
    transition: background-color 0.3s;
}

.radio-label:hover,
.checkbox-label:hover {
    background-color: #f8f9fa;
}

.radio-label input,
.checkbox-label input {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-calculate {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--ui-radius-sm, 6px);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    margin-top: 0.5rem;
}

.btn-calculate:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-calculate:active {
    transform: translateY(0);
}

.btn-send {
    padding: 0.6rem 1rem;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: var(--ui-radius-sm, 6px);
    font-weight: 600;
    cursor: pointer;
}
.btn-send:hover:not(:disabled) { background: #219a52; }
.btn-send:disabled { opacity: 0.7; cursor: not-allowed; }

.send-msg { margin-top: 0.35rem; font-size: 0.9rem; }
.send-msg.ok { color: #27ae60; }
.send-msg.error { color: #c0392b; }

/* —— Заказать: кнопка и модалка —— */
.order-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.btn-order {
    display: inline-block;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--brand-primary, #c41e3a);
    color: #fff;
    border: none;
    border-radius: var(--ui-radius, 8px);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background-color 0.2s, transform 0.15s;
}
.btn-order:hover:not(:disabled),
.btn-order:focus-visible:not(:disabled) {
    background: var(--brand-primary-hover, #a01830);
    transform: translateY(-1px);
}
.btn-order:active:not(:disabled) {
    background: var(--brand-primary-hover, #a01830);
    filter: brightness(0.92);
    transform: translateY(0);
}
.btn-order:disabled { opacity: 0.65; cursor: not-allowed; }
.btn-order-submit { margin-top: 0.35rem; }
.order-admin-downloads { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.btn-admin-dl {
    padding: 0.35rem 0.65rem;
    font-size: 0.82rem;
    background: #fff;
    color: var(--brand-primary, #c41e3a);
    border: 1px solid var(--brand-primary, #c41e3a);
    border-radius: var(--ui-radius-sm, 6px);
    cursor: pointer;
    font-weight: 600;
}
.btn-admin-dl:hover:not(:disabled) { background: #fdf0f2; }
.btn-admin-dl:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    color: #888;
    border-color: #ccc;
}

.btn-stamp-dims-reset {
    display: inline-block;
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: #444;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: var(--ui-radius-sm, 6px);
    cursor: pointer;
    box-sizing: border-box;
}
.btn-stamp-dims-reset:hover {
    border-color: var(--brand-primary, #c41e3a);
    color: var(--brand-primary, #c41e3a);
    background: #fdf0f2;
}
.stamp-dims-reset-wrap .btn-stamp-dims-reset {
    height: 2.15rem;
}

body.order-modal-open { overflow: hidden; }
.order-modal[hidden] { display: none !important; }
.order-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.order-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 12, 14, 0.55);
}
.order-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(92vh, 720px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: var(--ui-radius-lg, 12px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    padding: 1.15rem 1.25rem 1.35rem;
    border-top: 4px solid var(--brand-primary, #c41e3a);
    box-sizing: border-box;
}
/* embed: modal band placed over the visible slice of the tall iframe */
html.tamp-embed .order-modal.order-modal--in-view {
    inset: auto;
    left: 0;
    right: 0;
    width: 100%;
    align-items: flex-start;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
html.tamp-embed .order-modal.order-modal--in-view .order-modal-dialog {
    max-height: calc(100% - 1.5rem);
    margin: 0 auto;
}
.order-modal-close {
    position: absolute;
    top: 0.45rem;
    right: 0.55rem;
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    border-radius: var(--ui-radius-xs, 4px);
}
.order-modal-close:hover {
    color: var(--brand-primary, #c41e3a);
    background: #f8f0f2;
}
.order-modal-title {
    margin: 0 1.5rem 0.75rem 0;
    font-size: 1.2rem;
    color: #222;
}
.order-modal-summary {
    background: linear-gradient(135deg, #faf6f7 0%, #f3e8eb 100%);
    border: 1px solid #e8d0d6;
    border-radius: var(--ui-radius, 8px);
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.9rem;
}
.order-sum-desc {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2a1a1e;
    margin-bottom: 0.4rem;
    line-height: 1.35;
    word-break: break-word;
}
.order-sum-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.88rem;
    color: #444;
}
.order-sum-meta strong { color: var(--brand-primary, #c41e3a); font-weight: 700; }
.order-form { display: flex; flex-direction: column; gap: 0.65rem; }
.order-row { display: flex; gap: 0.5rem; }
.order-row-3 > .order-field { flex: 1 1 0; min-width: 0; }
.order-row-2 > .order-field { flex: 1 1 0; min-width: 0; }
.order-field label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
    color: #444;
}
.order-field .req { color: var(--brand-primary, #c41e3a); }
.order-field .input-field,
.order-field .order-comment {
    width: 100%;
    box-sizing: border-box;
}
.order-file { padding: 0.35rem 0; font-size: 0.85rem; }
.order-comment { resize: vertical; min-height: 4.5rem; }
.order-comment-count {
    text-align: right;
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.15rem;
}
@media (max-width: 540px) {
    .order-row-3, .order-row-2 { flex-direction: column; }
    .order-modal {
        padding: 0.5rem;
        align-items: flex-end;
    }
    .order-modal-dialog {
        padding: 1rem;
        max-height: 96vh;
        border-radius: var(--ui-radius-lg, 12px) 12px 0 0;
    }
}

.order-thanks[hidden] { display: none !important; }
.order-thanks {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}
.order-thanks-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 12, 14, 0.55);
}
.order-thanks-dialog {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    background: #fff;
    border-radius: var(--ui-radius-xl, 14px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    padding: 1.35rem 1.4rem 1.45rem;
    border-top: 4px solid var(--brand-primary, #c41e3a);
    text-align: center;
    box-sizing: border-box;
}
.order-thanks-photo {
    display: block;
    width: min(220px, 68vw);
    height: auto;
    margin: 0.15rem auto 0.85rem;
    border-radius: var(--ui-radius-lg, 12px);
    object-fit: cover;
    aspect-ratio: 1 / 1;
}
.order-thanks-title {
    margin: 0 1.5rem 0.45rem;
    font-size: 1.35rem;
    color: #222;
    line-height: 1.25;
}
.order-thanks-text {
    margin: 0 0 1.1rem;
    font-size: 1.02rem;
    color: #444;
    line-height: 1.4;
}
.order-thanks-ok {
    min-width: 8rem;
}
html.tamp-embed .order-thanks.order-modal--in-view {
    inset: auto;
    left: 0;
    right: 0;
    width: 100%;
    align-items: flex-start;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Результаты */
.results-card {
    background: #f8f9fa;
    border-radius: var(--ui-radius, 8px);
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
}

.nds-check-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.55rem 0 0.1rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
}
.nds-check-label input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--brand-primary, #c41e3a);
    cursor: pointer;
}

.result-label {
    color: #666;
    font-weight: 500;
}

.result-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
}

.result-item.total .result-value {
    color: var(--accent-color);
    font-size: 1.35rem;
}

.results-details {
    background: #f8f9fa;
    border-radius: var(--ui-radius, 8px);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    color: #666;
}

.results-details h4 {
    color: var(--primary-color);
    margin-bottom: 0.4rem;
}

.results-details ul {
    list-style: none;
    padding-left: 0;
}

.results-details li {
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-color);
}

.results-details li:last-child {
    border-bottom: none;
}

.sub-options {
    margin-left: 1.5rem;
    margin-top: 0.3rem;
    animation: fadeIn 0.3s ease;
}

/* Доп. параметры постпечатной операции (открываются при выборе опции) */
.postpress-sub-options {
    padding: 0.4rem 0.65rem;
    margin-top: 0.3rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--ui-radius, 8px);
    border-left: 3px solid var(--border-color, #e0e0e0);
}

/* Ламинация: название и кнопки толщин из расходки */
.lamination-type-thickness-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: flex-end;
    margin-top: 0.15rem;
}

.lamination-type-col {
    flex: 1 1 14rem;
    min-width: 0;
}

.lamination-thickness-col {
    margin-top: 0.35rem;
    width: 100%;
}

.lamination-thickness-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.lamination-thickness-btn {
    font: inherit;
    padding: 0.22rem 0.55rem;
    border: 1px solid #bbb;
    border-radius: var(--ui-radius-xs, 4px);
    background: #f4f4f4;
    cursor: pointer;
    color: #222;
}

.lamination-thickness-btn:hover {
    border-color: #3498db;
}

.lamination-thickness-btn.is-active {
    background: #3498db;
    border-color: #2980b9;
    color: #fff;
}

.lamination-thickness-unit {
    font-size: 0.9rem;
    color: var(--text-color, #333);
    white-space: nowrap;
    margin-left: 0.1rem;
}

/* Каталог/брошюра: На скрепку | На пружину | КБС — три колонки в одну строку */
#specialSpringScrepkaRow.special-bros-binding-row,
.special-bros-binding-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: stretch;
    margin-bottom: 0.65rem;
    width: 100%;
    box-sizing: border-box;
}
.special-bros-binding-row > .special-block {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.5rem 0.45rem;
    border: 1px solid #d8dee8;
    border-radius: var(--ui-radius, 8px);
    background: #fafbfd;
}
.special-bros-binding-row > .special-block > div:first-child {
    margin-bottom: 0.35rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e8edf4;
}
.special-bros-binding-row .special-button-grid {
    width: 100%;
}
.special-bros-binding-row .special-button-grid .special-option-btn {
    flex: 1 1 calc(50% - 0.2rem);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.special-bros-binding-row .special-button-grid .special-option-btn img {
    max-width: 100%;
    height: auto;
}
@media (max-width: 720px) {
    #specialSpringScrepkaRow.special-bros-binding-row,
    .special-bros-binding-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }
}

/* Папки: типы BEZ / S / 1K / 2K — всегда в одну строку (не путать с шубер/коробки) */
#specialPapkiTypeButtons.papki-type-buttons,
.papki-type-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.35rem;
    width: 100%;
    align-items: stretch;
}
#specialPapkiTypeButtons.papki-type-buttons .special-option-btn,
.papki-type-buttons .special-option-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
    max-width: none;
    border: 1px solid #ddd;
    border-radius: var(--ui-radius-sm, 6px);
    background: #fff;
    padding: 0.3rem 0.25rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}
#specialPapkiTypeButtons.papki-type-buttons .special-option-btn img,
.papki-type-buttons .special-option-btn img {
    width: 100%;
    max-width: 5.5rem;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
}
#specialPapkiTypeButtons.papki-type-buttons .special-option-btn .papki-type-label,
.papki-type-buttons .special-option-btn .papki-type-label {
    font-size: 0.72rem;
    margin-top: 0.15rem;
    line-height: 1.15;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
}

/* Коробки: типы — одна строка на всю ширину блока (не 2 колонки шубера) */
#specialBoxesTypeButtons.boxes-type-buttons,
.boxes-type-buttons {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 0.4rem;
    width: 100%;
    align-items: stretch;
    margin: 0 0 0.25rem;
}
#specialBoxesTypeButtons.boxes-type-buttons .special-option-btn,
.boxes-type-buttons .special-option-btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto !important;
    max-width: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 0.35rem 0.25rem;
}
#specialBoxesTypeButtons.boxes-type-buttons .special-option-btn img,
.boxes-type-buttons .special-option-btn img {
    width: min(5.75rem, 100%) !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    margin: 0 auto;
}

/* Шубер: ориентация — только 2 колонки, только у .shuber-orient-buttons */
#specialShuberButtons.shuber-orient-buttons,
.shuber-orient-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.65rem;
    width: 100%;
    align-items: stretch;
}
#specialShuberButtons.shuber-orient-buttons .special-option-btn,
.shuber-orient-buttons .special-option-btn {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.45rem 0.35rem;
}
#specialShuberButtons.shuber-orient-buttons .special-option-btn img,
.shuber-orient-buttons .special-option-btn img {
    display: block;
    width: min(7.5rem, 85%) !important;
    height: auto !important;
    max-width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    margin: 0 auto;
}

/* Папки: сетка превью самосборных штампов (SVG), 4 в ряд */
.papki-self-build-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem 0.45rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .papki-self-build-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.papki-self-build-card {
    margin: 0;
    padding: 0;
    border: 1px solid #dbe7f5;
    border-radius: var(--ui-radius, 8px);
    background: #fff;
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
}

.papki-self-build-card.is-selected {
    outline: 2px solid var(--selection-outline, #c41e3a);
    background: color-mix(in srgb, var(--selection-outline, #c41e3a) 12%, white);
}

.papki-self-build-thumb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 5rem;
    padding: 0.35rem;
    overflow: hidden;
}

.papki-self-build-thumb-wrap img {
    max-width: 100%;
    max-height: 4.5rem;
    width: auto;
    height: auto;
    object-fit: contain;
}

.papki-self-build-caption {
    display: block;
    font-size: 0.72rem;
    line-height: 1.25;
    color: #334155;
    padding: 0 0.25rem 0.4rem;
}

.papki-custom-size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-width: 36rem;
}

/* Индикатор загрузки */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Улучшенная визуализация результатов */
.result-value {
    transition: color 0.3s;
}

.result-item.total .result-value {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Блокнот: подложка под обложкой — два взаимоисключающих варианта (радио) */
.notebook-cover-pad-row .notebook-cover-pad-check {
    width: 100%;
    margin: 0;
}

.notebook-cover-pad-no-print-note {
    font-size: 0.84rem;
    color: #444;
    margin-top: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: #f4f7fb;
    border-radius: var(--ui-radius-sm, 6px);
    border: 1px solid #e2e8f0;
    line-height: 1.4;
}

/* Парные строки в динамических секциях листов (Обложка, Блок и т.д.) */
.dynamic-sheets .param-row-pair {
    margin-bottom: 0.5rem;
}
.dynamic-sheets .param-row-pair .param-group {
    margin-bottom: 0;
}

/* Временно: размер листа и зона с приладкой в той же сетке, что «Тип бумаги | Плотность» */
.sheet-paper-block .sheet-paper-makeready-note {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: #555;
    margin: 0.2rem 0 0;
    line-height: 1.35;
}

/* Какой размер изделия (мм) уходит в расчёт при выборе картинки брошюровки */
.special-ops-calc-size-note {
    margin-top: 0.4rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #333;
    background: #f4f7fb;
    border-radius: var(--ui-radius-sm, 6px);
    border: 1px solid #e2e8f0;
    white-space: pre-line;
}

.item-bleed-fit-note {
    margin-top: 0.3rem;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #444;
}
.format-size-hint {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    line-height: 1.3;
    color: #666;
}
.item-bleed-fit-note .item-bleed-line strong {
    color: #222;
}
.item-bleed-fit-note .item-fit-warning {
    margin-top: 0.3rem;
    padding: 0.35rem 0.45rem;
    background: #fff8e6;
    border: 1px solid #f0c14b;
    border-radius: var(--ui-radius-sm, 6px);
    color: #5c4a00;
}
.item-bleed-fit-note .item-fit-warning-detail {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: #664d03;
}

/* Адаптивность: на узком экране — одна колонка, параметры сверху */
@media (max-width: 968px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .calculator-results {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
    }
    html.tamp-embed .calculator-results.is-embed-sticky {
        overflow: visible;
    }
    .calculator-params,
    .calculator-results {
        padding: 0.85rem 0.95rem;
    }
}

@media (max-width: 640px) {
    .main--calculator .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .param-row-pair {
        grid-template-columns: 1fr;
    }
    .checkbox-group-postpress {
        grid-template-columns: 1fr;
    }
    .calc-type-nav__row {
        flex-wrap: wrap;
    }
    .quantity-row-wrap {
        flex-wrap: wrap;
    }
    #specialPapkiTypeButtons.papki-type-buttons,
    .papki-type-buttons {
        flex-wrap: wrap !important;
    }
    .calculator-params h3,
    .calculator-results h3 {
        font-size: 1.15rem;
    }
}

/* Визуальный выбор схемы фальцовки для буклета */
.booklet-fold-options {
    margin-top: 0.4rem;
}
.booklet-fold-title {
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: var(--text-color);
}
.booklet-fold-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}
.booklet-fold-btn {
    border: 2px solid var(--border-color);
    background: #fff;
    border-radius: var(--ui-radius, 8px);
    padding: 0.2rem 0.2rem 0.35rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s, background-color 0.2s;
}
.booklet-fold-btn:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 1px rgba(52, 152, 219, 0.15);
}
.booklet-fold-btn.active {
    border-color: var(--accent-color);
    background: #fdf6f6;
    box-shadow: 0 0 0 1px rgba(231, 76, 60, 0.2);
}
.booklet-fold-img {
    max-width: 100%;
    height: auto;
    display: block;
}
.booklet-fold-btn span {
    font-size: 0.8rem;
    color: var(--text-color);
}

/* Разбивка постпечати в «Детали расчёта» */
.calc-postpress-items {
    margin: 0.2rem 0 0 0;
    padding-left: 1rem;
    font-size: 0.88rem;
    color: var(--text-color, #333);
    opacity: 0.95;
}
.calc-postpress-items li {
    margin: 0.12rem 0;
}

.param-group[data-param="paperDensity"] {
    position: relative;
}

/* Плотность: до 5 значений из шаблона — кнопки + контрольная подпись */
.sheet-density-quick-buttons,
.single-density-quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.sheet-density-chip-btn,
.single-density-chip-btn {
    font: inherit;
    padding: 0.28rem 0.6rem;
    border: 1px solid #bbb;
    border-radius: var(--ui-radius-xs, 4px);
    background: #f4f4f4;
    cursor: pointer;
    color: #222;
}
.sheet-density-chip-btn:hover,
.single-density-chip-btn:hover {
    border-color: #3498db;
}
.sheet-density-chip-btn.is-active,
.single-density-chip-btn.is-active {
    background: #3498db;
    border-color: #2980b9;
    color: #fff;
}
.sheet-density-select-hidden,
.single-density-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sheet-paper-density-group {
    position: relative;
}
.sheet-density-caption,
.single-density-caption {
    font-size: 0.88rem;
    color: #555;
    margin-top: 0.3rem;
    line-height: 1.35;
}

/* —— Переключатель калькуляторов (ряд иконок) —— */
.calc-type-nav {
    grid-column: 1 / -1;
    margin: 0 0 0.35rem;
    padding: 0;
}
.calc-type-nav__row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    width: 100%;
    align-items: stretch;
}
.calc-type-nav__row--more {
    margin-top: 0.4rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
    gap: 0.4rem;
}
.calc-type-nav__row--more .calc-type-tile {
    flex: none;
    max-width: none;
    min-width: 0;
}
.calc-type-tile {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    padding: 0.45rem 0.25rem 0.4rem;
    border: 1px solid var(--border-color, #e5e5e8);
    border-radius: var(--ui-radius-lg, 10px);
    background: #fff;
    color: var(--text-color, #334155);
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(26, 26, 26, 0.04);
}
.calc-type-tile:hover {
    border-color: var(--brand-primary, #c41e3a);
    box-shadow: 0 2px 8px rgba(196, 30, 58, 0.12);
}
.calc-type-tile:focus-visible {
    outline: 2px solid var(--brand-primary, #c41e3a);
    outline-offset: 2px;
}
.calc-type-tile__icon {
    width: 2.35rem;
    height: 2.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calc-type-tile__icon img,
.calc-type-tile__icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.calc-type-tile__label {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.calc-type-tile.is-active {
    background: var(--brand-primary, #c41e3a);
    border-color: var(--brand-primary, #c41e3a);
    color: #fff;
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.28);
}
.calc-type-tile.is-active .calc-type-tile__icon img {
    filter: brightness(0) invert(1);
}
.calc-type-tile.is-active .calc-type-tile__icon svg {
    stroke: #fff;
    fill: #fff;
}
.calc-type-tile.is-more-toggle.is-expanded {
    border-color: var(--brand-primary, #c41e3a);
    color: var(--brand-primary, #c41e3a);
}
.calc-type-tile__check {
    position: absolute;
    top: 0.28rem;
    right: 0.28rem;
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 50%;
    background: #fff;
    color: var(--brand-primary, #c41e3a);
    font-size: 0.55rem;
    line-height: 0.85rem;
    text-align: center;
    font-weight: 700;
    display: none;
}
.calc-type-tile.is-active .calc-type-tile__check {
    display: block;
}

/* Коробки: явный фокус на активном штампе */
#specialBoxesStampPreviewWrap.is-stamp-active {
    border-color: #c41e3a;
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.18);
}

@keyframes boxes-stamp-preview-flash {
    0% { box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.55); }
    70% { box-shadow: 0 0 0 10px rgba(196, 30, 58, 0); }
    100% { box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.18); }
}

#specialBoxesStampPreviewWrap.boxes-stamp-preview-flash {
    animation: boxes-stamp-preview-flash 0.7s ease-out 1;
}

.boxes-stamp-active-label .boxes-stamp-active-name {
    word-break: break-word;
}

.boxes-stamp-active-label .boxes-stamp-active-dims {
    font-weight: 500;
    color: #8a3a48;
}

.boxes-calc-stamp-banner {
    margin: 0 0 0.35rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.9em;
    color: #7a1020;
    background: #fff5f6;
    border: 1px solid #f0c2cb;
    border-radius: var(--ui-radius-xs, 5px);
}

.boxes-calc-stamp-banner--custom {
    color: #345;
    background: #f3f7fb;
    border-color: #c8ddf5;
}

.boxes-similar-stamps-list {
    max-height: 14rem;
    overflow: auto;
}

.boxes-similar-stamp-btn {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    width: 100%;
    text-align: left;
    margin: 0.2rem 0;
    padding: 0.4rem 0.5rem;
    border: 1px solid #dbe7f5;
    border-radius: var(--ui-radius-sm, 6px);
    background: #fff;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #234;
    box-sizing: border-box;
}

.boxes-similar-stamp-btn:hover {
    border-color: #c41e3a;
    background: #fffafb;
}

.boxes-similar-stamp-btn.is-selected {
    border: 2px solid #c41e3a;
    background: #fff5f6;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.12);
}

.boxes-similar-stamp-mark {
    flex: 0 0 auto;
    min-width: 4.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: transparent;
    line-height: 1.35;
}

.boxes-similar-stamp-btn.is-selected .boxes-similar-stamp-mark {
    color: #c41e3a;
}

.boxes-similar-stamp-text {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

@media (max-width: 768px) {
    .calc-type-nav__row--more {
        grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
    }
    .calc-type-tile__icon {
        width: 2rem;
        height: 2rem;
    }
    .calc-type-tile__label {
        font-size: 0.68rem;
    }
}

/* —— Дизайн: скругление углов окна калькулятора (--ui-radius) —— */
html.tamp-embed .main--calculator,
html.tamp-calc-client .main--calculator,
.main--calculator {
    --calc-radius: var(--ui-radius, 8px);
}
.main--calculator .calculator-wrapper .input-field,
.main--calculator .calculator-wrapper select,
.main--calculator .calculator-wrapper textarea,
.main--calculator .calculator-wrapper button,
.main--calculator .calculator-wrapper .special-option-btn,
.main--calculator .calculator-wrapper .papki-format-btn,
.main--calculator .calculator-wrapper .pkg-two-sheet-btn,
.main--calculator .calculator-wrapper .boxes-similar-stamp-btn,
.main--calculator .calculator-wrapper .papki-self-build-card,
.main--calculator .calculator-wrapper .quantity-quick-btn,
.main--calculator .calculator-wrapper .lamination-thickness-btn,
.main--calculator .calculator-wrapper .booklet-fold-btn,
.main--calculator .calculator-wrapper .sheet-density-chip-btn,
.main--calculator .calculator-wrapper .single-density-chip-btn,
.main--calculator .calculator-results,
.main--calculator .client-calc-summary,
.main--calculator .calc-type-tile,
.main--calculator .special-package-calc-size-note,
.main--calculator .special-shuber-spread-caption,
.main--calculator .boxes-stamp-active-label,
.main--calculator #specialBoxesStampPreviewWrap,
.main--calculator #specialBoxesStampPreviewImg,
.main--calculator #specialPackageHandlePreviewImg,
.main--calculator .param-group,
.main--calculator .radio-label,
.main--calculator .checkbox-label,
.order-modal .order-modal-dialog,
.order-modal .order-modal-summary,
.order-modal .order-field input,
.order-modal .order-field textarea,
.order-modal .order-field select {
    border-radius: var(--ui-radius, 8px) !important;
}
/* круглые маркеры / чекбоксы — не скругляем «квадратом» */
.main--calculator .calc-type-tile__check,
.main--calculator input[type="radio"],
.main--calculator input[type="checkbox"],
.main--calculator .radio-custom {
    border-radius: 50% !important;
}
.main--calculator .calc-admin-badge {
    border-radius: 999px !important;
}


