/* ============================================
   Coffee Evaluation Calculator - Assessment (tabs, parameters, score circles, sliders)
   ============================================ */

.assessment-tabs {
display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    background: var(--cream-dark);
    padding: var(--spacing-xs);
    border-radius: var(--radius-lg);
    box-shadow: inset 0 2px 4px var(--shadow);
}

.assessment-tabs .tab-btn {
flex: 1;
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.assessment-tabs .tab-btn:hover {
background: var(--cream-light);
}

.assessment-tabs .tab-btn.active {
background: var(--accent);
    color: var(--coffee-darkest);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Tab Content */

.tab-content {
display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
display: block;
}

@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* CVA Parameters */

.cva-parameter {
margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--cream-dark);
    border-radius: var(--radius-md);
}

.parameter-header {
display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.parameter-name {
font-weight: 600;
    color: var(--coffee-dark);
}

.parameter-value {
background: var(--coffee-dark);
    color: white;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    transition: background-color 0.3s ease;
}

.parameter-slider {
width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, 
        var(--quality-defective) 0%, 
        var(--quality-poor) 20%, 
        var(--quality-fair) 40%, 
        var(--quality-good) 60%, 
        var(--quality-very-good) 80%, 
        var(--quality-excellent) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.parameter-slider::-webkit-slider-thumb {
-webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--coffee-dark);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.parameter-slider::-webkit-slider-thumb:hover {
transform: scale(1.15);
    box-shadow: 0 3px 8px var(--shadow-hover);
}

.parameter-slider::-webkit-slider-thumb:active {
transform: scale(1.2);
    transition: transform 0.1s ease;
}

.parameter-slider::-moz-range-thumb {
width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--coffee-dark);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.parameter-slider::-moz-range-thumb:hover {
transform: scale(1.15);
    box-shadow: 0 3px 8px var(--shadow-hover);
}

.parameter-slider::-moz-range-thumb:active {
transform: scale(1.2);
    transition: transform 0.1s ease;
}

/* ============================================
   Score Circles (CVA Parameters — 9 кружков на параметр)
   Неактивный: светлый фон, тёмная цифра
   Выбранный: кофейная заливка, светлая цифра
   ============================================ */

.score-circles {
display: flex;
    gap: var(--score-circles-gap);
    justify-content: center;
    padding: 4px 0;
    flex-wrap: wrap;
}

.score-circle {
    width: var(--score-circle-size);
    height: var(--score-circle-size);
    border-radius: 50%;
    border: 2px solid #C5B9B1;
    background: var(--cream-light);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--score-circle-font);
    font-weight: 700;
    color: var(--coffee-dark);
    user-select: none;
    position: relative;
    box-shadow: 0 1px 3px rgba(62, 39, 35, 0.08);
}

.score-circle:hover {
transform: scale(1.15);
    box-shadow: 0 3px 10px var(--shadow-hover);
    border-color: var(--coffee-medium);
}

.score-circle:active {
transform: scale(0.92);
    transition: transform 0.1s ease;
}

/* Выбранный кружок — кофейная заливка, инвертированная цифра */

.score-circle.selected {
background: linear-gradient(135deg, var(--coffee-dark) 0%, var(--coffee-medium) 100%);
    border-color: var(--coffee-dark);
    color: #FFFFFF;
    box-shadow: 0 3px 12px rgba(93, 64, 55, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.15);
    transform: scale(1.08);
}

.score-circle.selected:hover {
transform: scale(1.18);
    box-shadow: 0 4px 16px rgba(93, 64, 55, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, var(--coffee-medium) 0%, var(--coffee-light) 100%);
}

/* Анимация появления при выборе */

.score-circle.selected::before {
content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: scoreRingPulse 0.4s ease-out;
}

@keyframes scoreRingPulse {
0% {
        opacity: 0.8;
        transform: scale(0.85);
    }
    100% {
        opacity: 0;
        transform: scale(1.15);
    }
}

/* Цветовые акценты для разных диапазонов баллов */

.score-circle[data-score="1"],
.score-circle[data-score="2"] {
border-color: #E57373;
    color: #C62828;
}

.score-circle[data-score="3"],
.score-circle[data-score="4"] {
border-color: #FFB74D;
    color: #E65100;
}

.score-circle[data-score="5"],
.score-circle[data-score="6"] {
border-color: var(--coffee-lighter);
    color: var(--coffee-dark);
}

.score-circle[data-score="7"],
.score-circle[data-score="8"],
.score-circle[data-score="9"] {
border-color: #81C784;
    color: #2E7D32;
}

/* Выбранный кружок — единый кофейный стиль */

.score-circle.selected {
border-color: var(--coffee-dark) !important;
    color: #FFFFFF !important;
}

/* ============================================
   Descriptive Parameter Styling
   Цветные бейджи значений для каждого параметра
   ============================================ */

.descriptive-parameter .parameter-name {
font-size: 0.95rem;
}

.descriptive-parameter .desc-value-badge {
min-width: 48px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #FFFFFF;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Цветные бейджи по параметрам */

.descriptive-parameter[data-param="aromaIntensity"] .desc-value-badge {
background: linear-gradient(135deg, #FFB300, #E65100);
}

.descriptive-parameter[data-param="flavorIntensity"] .desc-value-badge {
background: linear-gradient(135deg, #A1887F, #6D4C41);
}

.descriptive-parameter[data-param="acidityIntensity"] .desc-value-badge {
background: linear-gradient(135deg, #66BB6A, #2E7D32);
}

.descriptive-parameter[data-param="sweetnessIntensity"] .desc-value-badge {
background: linear-gradient(135deg, #FF9800, #E65100);
}

.descriptive-parameter[data-param="mouthfeelIntensity"] .desc-value-badge {
background: linear-gradient(135deg, #8D6E63, #4E342E);
}

/* Smooth slider hit area — невидимая область захвата */

.smooth-slider-hitarea {
/* Невидимый хитбокс 48x48 вокруг ползунка */
}

/* Smooth slider container — блокируем скролл */

.smooth-slider-container {
touch-action: none;
}

/* Descriptive Assessment Sliders (0-15 range) */

.descriptive-slider {
width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, 
        #E0E0E0 0%, 
        var(--coffee-lighter) 30%, 
        var(--coffee-medium) 60%, 
        var(--coffee-dark) 100%);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.descriptive-slider::-webkit-slider-thumb {
-webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--coffee-medium);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.descriptive-slider::-webkit-slider-thumb:hover {
transform: scale(1.15);
    box-shadow: 0 3px 8px var(--shadow-hover);
}

.descriptive-slider::-webkit-slider-thumb:active {
transform: scale(1.2);
    transition: transform 0.1s ease;
}

.descriptive-slider::-moz-range-thumb {
width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--coffee-medium);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.descriptive-slider::-moz-range-thumb:hover {
transform: scale(1.15);
    box-shadow: 0 3px 8px var(--shadow-hover);
}

.descriptive-slider::-moz-range-thumb:active {
transform: scale(1.2);
    transition: transform 0.1s ease;
}

/* Поле комментария под слайдером интенсивности */

.desc-comment-input {
    width: 100%;
    margin-top: 8px;
    padding: 6px 12px;
    border: 1px solid var(--coffee-lighter);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--cream-light);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.desc-comment-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 183, 77, 0.2);
}

.desc-comment-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Контейнер для комментария блока */
.desc-block-comment {
    margin-top: 10px;
}

/* Textarea комментария блока */
.desc-block-comment-input {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--cream-light);
    border: 1px solid var(--coffee-lighter);
    border-radius: var(--radius-sm);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.desc-block-comment-input::placeholder {
    color: var(--neutral-muted);
    font-style: italic;
}

.desc-block-comment-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(168, 130, 89, 0.15);
}

/* Main Tastes checkboxes (SCA CVA Descriptive Form) */

.main-taste-limit-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.main-taste-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.main-tastes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 4px;
}

.main-taste-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    user-select: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--cream-light);
    border: 1px solid var(--coffee-lighter);
    transition: all 0.2s ease;
}

.main-taste-label:hover {
    background: var(--cream);
    border-color: var(--coffee-light);
}

.main-taste-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--coffee-light);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.main-taste-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.main-taste-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Заблокированные чекбоксы Main Tastes (когда выбрано 2 из 2) */
.main-taste-checkbox:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: var(--coffee-lighter);
}

.main-taste-label:has(.main-taste-checkbox:disabled) {
    opacity: 0.45;
    cursor: not-allowed;
}

.main-taste-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 183, 77, 0.2);
}

.main-taste-text {
    font-weight: 500;
}

/* Penalty Section */

.penalty-grid {
display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

/* ============================================
   Descriptive Assessment Blocks (SCA CVA Combined Form)
   ============================================ */

.desc-block {
    background: var(--cream);
    border: 1px solid var(--cream-dark);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 2px 8px var(--shadow);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.desc-block-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--coffee-dark);
    margin: 0 0 var(--spacing-md) 0;
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--coffee-light);
}

.desc-block-sliders {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* CATA section inside a block */
.desc-block-cata {
    border-top: 1px dashed var(--cream-dark);
    padding-top: var(--spacing-md);
}

.desc-block-cata-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--coffee-medium);
    margin-bottom: var(--spacing-sm);
}

.desc-block-cata-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Стрелка у категорий с под-дескрипторами */
.cata-sub-arrow {
    font-size: 0.7em;
    opacity: 0.5;
    margin-left: 2px;
}

/* ===== Панель под-дескрипторов (под сеткой CATA) ===== */
.sub-descriptors-panel {
    display: none;
    width: 100%;
    margin-top: 12px;
    padding: 0;
    background: var(--cream-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--cream-dark);
    overflow: hidden;
    animation: subPanelSlideIn 0.25s ease;
}

@keyframes subPanelSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ряд под-дескрипторов (один родитель) */
.sub-desc-row {
    padding: 8px 14px;
    border-bottom: 1px solid var(--cream-dark);
}

.sub-desc-row:last-child {
    border-bottom: none;
}

/* Заголовок строки — короткая метка группы */
.sub-desc-row-header {
    margin-bottom: 6px;
}

.sub-desc-row-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--neutral-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Контейнер чекбоксов строки */
.sub-desc-row-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Кнопка-под-чекбокс (компактная, со скруглением rounded-md) */
.cata-sub-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: var(--cream-dark);
    border: 1px solid var(--coffee-light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.cata-sub-btn:hover {
    border-color: var(--accent);
    background: var(--cream-light);
}

/* Скрываем нативный чекбокс */
.cata-sub-btn input[type="checkbox"] {
    display: none;
}

/* Иконка чекбокса */
.cata-sub-icon {
    font-size: 0.85rem;
    line-height: 1;
    color: var(--coffee-light);
    transition: color 0.15s ease;
}

/* Текст под-дескриптора */
.cata-sub-text {
    font-size: 0.82rem;
    color: var(--coffee-medium);
}

/* Выбранная под-кнопка */
.cata-sub-btn:has(input:checked) {
    background: var(--accent);
    border-color: var(--coffee-dark);
}

.cata-sub-btn:has(input:checked) .cata-sub-icon {
    color: var(--coffee-darkest);
}

.cata-sub-btn:has(input:checked) .cata-sub-text {
    color: var(--coffee-darkest);
    font-weight: 600;
}

/* Main Tastes section inside a block */
.desc-block-main-tastes {
    border-top: 1px dashed var(--cream-dark);
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.desc-block-main-tastes-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--coffee-medium);
    margin-bottom: var(--spacing-sm);
}

.desc-block-main-tastes-items {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

/* Acidity type section */
.desc-block-acidity-type {
    border-top: 1px dashed var(--cream-dark);
    padding-top: var(--spacing-md);
}

.desc-block-acidity-type-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--coffee-medium);
    margin-bottom: var(--spacing-sm);
}

.desc-block-acidity-type-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.acidity-type-label {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--cream-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.acidity-type-label:hover {
    background: var(--coffee-light);
}

.acidity-type-radio {
    margin-top: 4px;
    accent-color: var(--coffee-dark);
}

.acidity-type-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Mouthfeel type section */
.desc-block-mouthfeel-type {
    border-top: 1px dashed var(--cream-dark);
    padding-top: var(--spacing-md);
}

.desc-block-mouthfeel-type-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--coffee-medium);
    margin-bottom: var(--spacing-sm);
}

/* Контейнер дескрипторов — одна колонка */
#desc-mouthfeel-type {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.mouthfeel-type-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--cream-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.mouthfeel-type-label:hover {
    background: var(--coffee-light);
}

.mouthfeel-type-checkbox {
    accent-color: var(--coffee-dark);
}

.mouthfeel-type-text {
    font-weight: 500;
}

/* Descriptive slider styles */
.descriptive-parameter {
    background: var(--cream-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
}

.descriptive-slider {
    accent-color: var(--coffee-dark);
}

.desc-value-badge {
    background: var(--coffee-dark) !important;
    color: #fff !important;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    min-width: 40px;
    text-align: center;
    display: inline-block;
}

/* ============================================
   Quality Blocks (Affective Assessment — 6 blocks)
   ============================================ */

#cva-quality-blocks {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.quality-block {
    background: var(--cream-dark);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    max-width: 100%;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.quality-block-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--coffee-dark);
    margin: 0 0 var(--spacing-md) 0;
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--accent);
}

.quality-block-body {
    display: grid;
    grid-template-columns: var(--quality-block-body-cols);
    grid-template-rows: auto auto;
    gap: var(--spacing-sm);
    align-items: start;
}

.quality-rows {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.quality-row {
    display: grid;
    grid-template-columns: var(--quality-row-cols);
    align-items: center;
}

.quality-row-label {
    font-size: var(--quality-label-size);
    font-weight: 600;
    color: var(--coffee-medium);
    text-align: right;
    padding-right: var(--spacing-sm);
}

/* Плейсхолдер для одиночных блоков — пустой, занимает пространство */
.quality-row-label-placeholder {
    visibility: hidden;
}

/* Spacer для result колонки — скрыт (result в отдельной колонке grid) */
.quality-row-result-spacer {
    display: none;
}

/* FINAL section — справа на десктопе, под строками на мобиле */
.quality-final-section {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-left: var(--spacing-sm);
    border-left: 1px dashed var(--coffee-lighter);
}

.quality-final-input {
    width: 100px;
    padding: 8px 12px;
    border: 2px solid var(--coffee-light);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--coffee-dark);
    cursor: default;
    /* Убираем стрелки и возможность редактирования */
    -moz-appearance: textfield;
    appearance: textfield;
}

.quality-final-input::-webkit-outer-spin-button,
.quality-final-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Penalty horizontal layout */
.penalty-horizontal-row {
    display: flex;
    gap: var(--penalty-row-gap);
    align-items: stretch;
    padding: var(--penalty-row-padding);
    background: var(--cream-dark);
    border-radius: var(--radius-md);
}

.penalty-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.penalty-group-label {
    font-size: var(--penalty-label-size);
    font-weight: 700;
    color: var(--coffee-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.penalty-button-row {
    display: flex;
    gap: 6px;
}

.penalty-btn {
    width: var(--penalty-btn-size);
    height: var(--penalty-btn-size);
    border-radius: 50%;
    border: 2px solid var(--coffee-lighter);
    background: var(--cream-light);
    color: var(--coffee-dark);
    font-size: var(--penalty-btn-font);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.penalty-btn:hover {
    transform: scale(1.15);
    border-color: var(--coffee-medium);
}

.penalty-btn.active {
    background: linear-gradient(135deg, var(--coffee-dark) 0%, var(--coffee-medium) 100%);
    color: #fff;
    border-color: var(--coffee-dark);
}

.penalty-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.penalty-group-defect-type {
    flex: 0 0 auto;
}

.penalty-defect-checks {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.penalty-defect-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--coffee-dark);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.penalty-defect-check:hover {
    background: var(--cream-light);
}

.penalty-defect-check input[type="checkbox"] {
    accent-color: var(--coffee-dark);
    cursor: pointer;
}

.penalty-defect-check input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.penalty-defect-check input[type="checkbox"]:disabled + span {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Ряд чекбоксов дефектов (горизонтальный) */
.penalty-defect-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ========== Вложенная структура истории (лоты) ========== */

.history-lots-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.history-lot {
    border: 1px solid var(--coffee-lighter);
    border-radius: 8px;
    overflow: hidden;
    background: var(--cream-light);
}

.history-lot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--coffee-light) 0%, var(--cream-light) 100%);
    transition: background 0.2s;
    user-select: none;
}

.history-lot-header:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--coffee-medium) 20%, transparent) 0%, var(--coffee-light) 100%);
}

.history-lot-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--coffee-dark);
    flex: 1;
}

.history-lot-count {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 500;
}

.history-lot-sessions {
    border-top: 1px solid var(--coffee-lighter);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    opacity: 0;
}

.history-lot-sessions.lot-open {
    max-height: 2000px;
    opacity: 1;
}

.history-sessions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.history-sessions-table thead {
    background: var(--coffee-light);
    color: var(--coffee-dark);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-sessions-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--coffee-lighter);
}

.history-sessions-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--coffee-lighter);
    vertical-align: middle;
}

.history-sessions-table tbody tr {
    transition: background 0.15s;
}

.history-sessions-table tbody tr:hover {
    background: color-mix(in srgb, var(--coffee-light) 40%, transparent);
}

.history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    margin: 0 2px;
}

.history-btn:hover {
    background: var(--coffee-lighter);
    transform: scale(1.1);
}

.history-btn-delete:hover {
    background: #ffcdd2;
}

/* Тёмная тема для истории */
body.dark-theme .history-lot {
    background: var(--dark-surface);
    border-color: var(--dark-border);
}

body.dark-theme .history-lot-header {
    background: var(--dark-surface);
}

body.dark-theme .history-lot-header:hover {
    background: var(--dark-bg);
}

body.dark-theme .history-lot-title {
    color: var(--dark-text);
}

body.dark-theme .history-sessions-table thead {
    background: var(--dark-bg);
    color: var(--dark-text);
}

body.dark-theme .history-sessions-table th,
body.dark-theme .history-sessions-table td {
    border-color: var(--dark-border);
}

body.dark-theme .history-btn:hover {
    background: var(--dark-border);
}

body.dark-theme .history-btn-delete:hover {
    background: #b71c1c30;
}

