:root {
    --primary: #0f766e;
    --primary-hover: #0d9488;
    --primary-light: #f0fdfa;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --danger: #ef4444;
    --success: #059669;

    --state-green: #059669;
    --state-green-bg: #ecfdf5;
    --state-yellow: #d97706;
    --state-yellow-bg: #fffbeb;
    --state-orange: #ea580c;
    --state-orange-bg: #fff7ed;
    --state-red: #dc2626;
    --state-red-bg: #fef2f2;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg); color: var(--text-main); padding: 1.25rem; line-height: 1.5; }
.container { max-width: 1440px; margin: 0 auto; }

/* Компактная шапка */
.app-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
}
.header-left-title {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.app-top-header h1 { font-size: 1.4rem; color: var(--text-main); }
.header-status-group { display: flex; align-items: center; gap: 0.75rem; }
.autosave-badge { font-size: 0.8rem; color: #047857; font-weight: 600; background: #ecfdf5; padding: 0.25rem 0.6rem; border-radius: 4px; border: 1px solid #a7f3d0; }
.btn-text-danger { background: none; border: none; color: var(--danger); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-text-danger:hover { color: #b91c1c; }

/* Вкладки */
.tabs { display: flex; gap: 0.5rem; }
.tab-btn { padding: 0.45rem 1rem; border: none; background: #e2e8f0; color: var(--text-main); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Двухколоночный макет */
.layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.left-panel { flex: 3; display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; }
.right-panel { flex: 1.5; position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; min-width: 330px; max-height: calc(100vh - 2rem); overflow-y: auto; padding-right: 2px; }

/* Панель «Отображение и точность» над списком */
.workspace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.toolbar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.toolbar-select {
    padding: 0.3rem 0.55rem;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.toolbar-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
}

.toolbar-action {
    margin-left: auto;
}

.btn-chip {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Карточки */
.card { background-color: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1.1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

/* Правая панель: блок результата */
.summary-box { background: #ecfdf5; border: 1px solid #a7f3d0; padding: 1.25rem; }
.summary-caption { text-align: center; font-size: 0.95rem; font-weight: 600; color: #065f46; }
.summary-result { font-size: 3.2rem; font-weight: 800; color: var(--success); text-align: center; line-height: 1; margin: 0.4rem 0; }
.summary-subtext { text-align: center; font-size: 0.8rem; color: #047857; margin-bottom: 0.75rem; }

/* Сетка кнопок экспорта */
.export-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.btn-export-pdf {
    background: #1e293b;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.55rem 0.5rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn-export-pdf:hover { background: #0f172a; }
.btn-export-excel {
    background: #065f46;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.55rem 0.5rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn-export-excel:hover { background: #047857; }

/* Блок обоснования */
.math-details { margin-top: 0.75rem; }
.math-details summary { cursor: pointer; color: var(--primary); font-size: 0.8rem; font-weight: 700; user-select: none; }
.math-box { background: #1e293b; color: #cbd5e1; padding: 0.75rem; border-radius: 4px; margin-top: 0.4rem; font-family: monospace; font-size: 0.75rem; white-space: pre-wrap; overflow-x: auto; }

/* Правая панель: шаблоны */
.control-card { display: flex; flex-direction: column; gap: 0.65rem; }
.card-section-title { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.preset-pill-grid { display: flex; flex-direction: column; gap: 0.35rem; }
.btn-preset-pill {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-preset-pill:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* Сводка по элементам */
.summary-list-card { display: flex; flex-direction: column; }
.summary-list-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-bottom: 0.6rem; }
.summary-list-header h3 { font-size: 0.95rem; margin: 0; }
.results-scroll-area { display: flex; flex-direction: column; gap: 0.5rem; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.result-item { padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.result-item:last-child { border-bottom: none; }
.result-header { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; }

/* Аккордеон элементов в левой колонке */
.elements-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.accordion-card {
    padding: 0;
    overflow: hidden;
    transition: border-color 0.2s;
    border-left: 5px solid var(--border);
}
.accordion-card.state-green { border-left-color: var(--state-green); }
.accordion-card.state-yellow { border-left-color: var(--state-yellow); }
.accordion-card.state-orange { border-left-color: var(--state-orange); }
.accordion-card.state-red { border-left-color: var(--state-red); }

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    user-select: none;
    background: #ffffff;
    transition: background-color 0.15s;
}
.accordion-card.is-collapsed .accordion-header { background: #f8fafc; }
.accordion-header:hover { background-color: var(--primary-light); }
.header-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.accordion-chevron { font-size: 0.8rem; color: var(--primary); width: 12px; }
.accordion-title { font-size: 1rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.accordion-body { padding: 0 1.1rem 1.1rem 1.1rem; border-top: 1px solid #f1f5f9; }

/* Формы */
.form-row { display: flex; gap: 0.75rem; margin-bottom: 0.65rem; }
.form-group { flex: 1; min-width: 0; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
select, input[type="number"], input[type="text"] { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.88rem; }
select:focus, input:focus { outline: none; border-color: var(--primary); }

/* Фильтры и теги */
.filters-row { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; background: #f1f5f9; padding: 0.6rem; border-radius: 6px; }
.search-filter-box input { background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.45rem 0.65rem; font-size: 0.85rem; }
.tags-container { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag-filter-btn { background: #ffffff; border: 1px solid #cbd5e1; color: #475569; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.55rem; border-radius: 4px; cursor: pointer; }
.tag-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.tag-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }

/* Зоны и дефекты */
.zone-list { display: flex; flex-direction: column; gap: 0.85rem; }
.zone-item { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.6rem; }
.zone-top-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.5rem; }
.zone-number-title { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.zone-area-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; }
.zone-area-group input { width: 95px; padding: 0.3rem 0.5rem; }
.defects-cards-container { display: flex; flex-direction: column; gap: 0.45rem; }

.defect-choice-card { background: #ffffff; border: 1px solid #e2e8f0; border-left: 4px solid var(--border); border-radius: 6px; padding: 0.65rem 0.75rem; cursor: pointer; transition: all 0.15s ease-in-out; }
.defect-choice-card.state-green { border-left-color: var(--state-green); }
.defect-choice-card.state-yellow { border-left-color: var(--state-yellow); }
.defect-choice-card.state-orange { border-left-color: var(--state-orange); }
.defect-choice-card.state-red { border-left-color: var(--state-red); }
.defect-choice-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.06); background: #fcfdfe; }
.defect-choice-card.selected { border-color: var(--primary); border-left-width: 6px; background: var(--primary-light); }

.defect-choice-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.defect-radio-label { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; line-height: 1.35; }
.defect-radio-label input[type="radio"] { margin-top: 0.15rem; accent-color: var(--primary); cursor: pointer; }
.defect-name-title { font-weight: 500; color: #0f172a; }
.defect-subtext { margin-top: 0.3rem; padding-left: 1.4rem; font-size: 0.75rem; color: #475569; }
.defect-subtext-works { margin-top: 0.2rem; padding-left: 1.4rem; font-size: 0.75rem; color: #047857; }
.defect-selected-options { margin-top: 0.45rem; padding-top: 0.45rem; padding-left: 1.4rem; border-top: 1px dashed #99f6e4; }
.defect-single-sign-label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; color: #115e59; cursor: pointer; }
.defect-single-sign-label input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }

/* Бейджи */
.badge { padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge-green { background: var(--state-green-bg); color: var(--state-green); border-color: #a7f3d0; }
.badge-yellow { background: var(--state-yellow-bg); color: var(--state-yellow); border-color: #fde68a; }
.badge-orange { background: var(--state-orange-bg); color: var(--state-orange); border-color: #fed7aa; }
.badge-red { background: var(--state-red-bg); color: var(--state-red); border-color: #fecaca; }
.badge-subtle { background: #f1f5f9; color: #64748b; font-weight: 600; border-color: #e2e8f0; }

/* Кнопки */
.btn { background-color: var(--primary); color: white; border: none; padding: 0.45rem 0.85rem; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 0.8rem; }
.btn:hover { background-color: var(--primary-hover); }
.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-outline { background: transparent; border: 1px dashed var(--primary); color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); padding: 0.25rem 0.5rem; border: 1px solid transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.btn-add-main { width: 100%; padding: 0.75rem; border: 2px dashed var(--border); background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 8px; font-size: 0.9rem; }
.btn-add-main:hover { border-color: var(--primary); color: var(--primary); background: #f0fdfa; }
.btn-text-action { background: none; border: none; color: var(--primary); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-text-action:hover { color: var(--primary-hover); }

/* Предупреждение о весах */
.weight-warning-box { margin-top: 0.6rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 0.5rem; text-align: center; }
#weightWarningText { color: var(--danger); font-size: 0.75rem; font-weight: 700; margin-bottom: 0.35rem; }
.btn-balance { background: #ffffff; color: var(--danger); border: 1px solid var(--danger); padding: 0.25rem 0.5rem; font-size: 0.75rem; font-weight: 700; border-radius: 4px; width: 100%; cursor: pointer; }
.btn-balance:hover { background: var(--danger); color: #ffffff; }

/* Пустое состояние */
.empty-state-card { background: #ffffff; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 2.5rem 1.5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.empty-state-icon { font-size: 2.5rem; }
.empty-state-card h3 { font-size: 1.15rem; color: var(--text-main); }
.empty-state-card p { font-size: 0.85rem; color: var(--text-muted); max-width: 450px; line-height: 1.4; margin-bottom: 0.5rem; }
.empty-state-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* Модальное окно печатного акта */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.6); display: flex; justify-content: center; align-items: center; z-index: 9999; padding: 1rem; }
.modal-container { background: #ffffff; width: 100%; max-width: 950px; max-height: 90vh; border-radius: 8px; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); background: #f8fafc; }
.print-document-body { background: #ffffff; color: #000000; padding: 2rem; font-family: 'Times New Roman', Times, serif; line-height: 1.35; overflow-y: auto; }

.act-header-normative { text-align: right; font-size: 0.85rem; margin-bottom: 1rem; }
.act-title-main { text-align: center; font-size: 1.25rem; font-weight: bold; margin-bottom: 1.25rem; }
.act-object-props { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; font-size: 0.9rem; }
.props-row { display: flex; align-items: center; }
.props-label { font-weight: bold; margin-right: 0.5rem; min-width: 140px; }
.props-input { border: none; border-bottom: 1px solid #000000; font-family: inherit; font-size: inherit; padding: 0.1rem 0.25rem; flex: 1; background: transparent; }
.props-input:focus { outline: none; border-bottom: 2px solid var(--primary); }

.act-vsn-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; margin-bottom: 1rem; font-size: 0.85rem; }
.act-vsn-table th, .act-vsn-table td { border: 1px solid #000000; padding: 0.4rem 0.5rem; }
.act-vsn-table th { background: #f8fafc; font-weight: bold; text-align: center; }
.tr-total { background: #f1f5f9; }
.act-verdict-box { margin-top: 0.75rem; font-size: 0.95rem; padding: 0.6rem; border: 1px solid #000000; background: #fafafa; }
.act-signatures-block { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.signature-line-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sig-role { border: none; border-bottom: 1px solid #000000; flex: 1; font-family: inherit; font-size: inherit; padding: 0.1rem; }
.sig-space { font-family: inherit; font-size: 0.9rem; white-space: nowrap; }

/* Правила печати */
@media print {
    body { background: #ffffff !important; padding: 0 !important; margin: 0 !important; }
    .no-print, .container, .tabs, .app-top-header { display: none !important; }
    .modal-overlay { position: static !important; background: none !important; padding: 0 !important; display: block !important; }
    .modal-container { box-shadow: none !important; max-width: 100% !important; max-height: none !important; border: none !important; }
    .print-document-body { padding: 0 !important; font-size: 11pt !important; }
    .act-vsn-table th { background: #e5e5e5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .props-input, .sig-role { border-bottom: 1px solid #000 !important; }
}

@media (max-width: 1024px) {
    .layout { flex-direction: column; }
    .right-panel { position: static; width: 100%; max-height: none; }
}

/* Вкладки категорий готовых серий */
.preset-cat-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
}

.preset-tab-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-align: center;
}

.preset-tab-btn:hover {
    color: var(--text-main);
}

.preset-tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Список интерактивных карточек шаблонов */
.preset-items-stack {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.preset-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease-in-out;
}

.preset-item-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.preset-item-card.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    border-left: 4px solid var(--primary);
}

.preset-item-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.preset-item-code {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.preset-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-check-icon {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.95rem;
    margin-left: 0.5rem;
}

/* БЛОК ТОЧНОЙ ИНТЕРПОЛЯЦИИ ПО ЗАМЕРАМ */
.interpolation-box {
    margin-top: 0.6rem;
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
}

.interp-row {
    display: flex;
    gap: 0.75rem;
}

.interp-row input[type="text"], .interp-row input[type="number"] {
    background: #ffffff;
    border: 1px solid #5eead4;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
}

.interpolation-box input[type="range"] {
    flex: 1;
    accent-color: var(--primary);
    cursor: pointer;
}

/* КАРТОЧКА ЗАКЛЮЧЕНИЯ ПО ГОСТ 31937-2011 */
.gost-card {
    background: #ffffff;
    border-left: 4px solid var(--primary);
}

.gost-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gost-text-block {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.45;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.65rem;
    margin-top: 0.4rem;
}

/* ТАБЛИЦА ДЕФЕКТНОЙ ВЕДОМОСТИ */
.statement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.statement-table-box {
    overflow-x: auto;
}

.statement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.statement-table th, .statement-table td {
    border: 1px solid var(--border);
    padding: 0.6rem 0.75rem;
    vertical-align: top;
}

.statement-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--text-main);
    text-align: left;
}

.statement-table tr:hover {
    background: #f8fafc;
}

.works-cell {
    color: #065f46;
    font-weight: 500;
}

/* РЕЖИМЫ ОПРЕДЕЛЕНИЯ ИЗНОСА В КАРТОЧКЕ ДЕФЕКТА */
.mode-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.mode-pill-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-pill-label:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mode-pill-label.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.mode-pill-label input[type="radio"] {
    display: none;
}

/* БЛОК АВТОМАТИЧЕСКОЙ ИНТЕРПОЛЯЦИИ */
.auto-interp-card {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    margin-top: 0.4rem;
}

.interp-input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.unit-badge {
    background: #ccfbf1;
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #99f6e4;
    white-space: nowrap;
}

.interp-calc-proof {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed #99f6e4;
    font-size: 0.78rem;
    color: #0f172a;
    line-height: 1.4;
}

.interp-disabled-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: #92400e;
    font-size: 0.8rem;
    line-height: 1.4;
    margin-top: 0.4rem;
}

/* ВКЛАДКА МАСТЕРА СЛОИСТЫХ КОНСТРУКЦИЙ (п. 1.6) */
.layered-container {
    max-width: 1300px;
    margin: 0 auto;
}

.layered-wizard-card {
    padding: 1.5rem;
}

.wizard-header h2 {
    font-size: 1.4rem;
    color: var(--text-main);
}

.wizard-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    max-width: 900px;
    line-height: 1.45;
}

.wizard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: flex-start;
}

.wizard-inputs-pane {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wizard-step-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.step-badge {
    display: inline-block;
    background: var(--primary);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.step-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1e293b;
}

.normative-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    font-style: italic;
}

.canvas-box-layered {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
}

.layered-verdict-box {
    border-left: 4px solid var(--primary);
}

@media (max-width: 1024px) {
    .wizard-grid {
        grid-template-columns: 1fr;
    }
}

:root {
    --primary: #0f766e;
    --primary-hover: #0d9488;
    --primary-light: #f0fdfa;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --danger: #ef4444;
    --success: #059669;

    --state-green: #059669;
    --state-green-bg: #ecfdf5;
    --state-yellow: #d97706;
    --state-yellow-bg: #fffbeb;
    --state-orange: #ea580c;
    --state-orange-bg: #fff7ed;
    --state-red: #dc2626;
    --state-red-bg: #fef2f2;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }
body { background-color: var(--bg); color: var(--text-main); padding: 1.25rem; line-height: 1.5; }
.container { max-width: 1440px; margin: 0 auto; }

/* Компактная шапка */
.app-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
}
.header-left-title { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.app-top-header h1 { font-size: 1.4rem; color: var(--text-main); }
.header-status-group { display: flex; align-items: center; gap: 0.75rem; }
.autosave-badge { font-size: 0.8rem; color: #047857; font-weight: 600; background: #ecfdf5; padding: 0.25rem 0.6rem; border-radius: 4px; border: 1px solid #a7f3d0; }
.btn-text-danger { background: none; border: none; color: var(--danger); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-text-danger:hover { color: #b91c1c; }

/* Вкладки */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tab-btn { padding: 0.45rem 0.85rem; border: none; background: #e2e8f0; color: var(--text-main); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.82rem; }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Двухколоночный макет */
.layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.left-panel { flex: 3; display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; }
.right-panel { flex: 1.5; position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; min-width: 330px; max-height: calc(100vh - 2rem); overflow-y: auto; padding-right: 2px; }

/* Панель «Отображение и точность» */
.workspace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.toolbar-group { display: flex; align-items: center; gap: 0.4rem; }
.toolbar-label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.toolbar-select { padding: 0.35rem 0.55rem; font-size: 0.82rem; border: 1px solid var(--border); border-radius: 4px; background: #fff; cursor: pointer; }
.toolbar-divider { width: 1px; height: 22px; background: #e2e8f0; }
.toolbar-action { margin-left: auto; }

.btn-chip { background: #f8fafc; border: 1px solid var(--border); color: var(--text-main); padding: 0.3rem 0.6rem; border-radius: 5px; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Карточки */
.card { background-color: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 1.1rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }

/* Правая панель: блок результата */
.summary-box { background: #ecfdf5; border: 1px solid #a7f3d0; padding: 1.25rem; transition: all 0.3s; }
.summary-caption { text-align: center; font-size: 0.95rem; font-weight: 600; color: #065f46; }
.summary-result { font-size: 3.2rem; font-weight: 800; color: var(--success); text-align: center; line-height: 1; margin: 0.4rem 0; }
.summary-subtext { text-align: center; font-size: 0.8rem; color: #047857; margin-bottom: 0.75rem; }

/* Аварийное состояние здания */
.emergency-summary { background: #fef2f2 !important; border-color: #fca5a5 !important; }
.emergency-summary .summary-result { color: var(--danger) !important; }
.emergency-summary .summary-caption, .emergency-summary .summary-subtext { color: #991b1b !important; }

.emergency-alert-banner {
    background: #fef2f2;
    border: 2px solid var(--danger);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: #991b1b;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.export-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.btn-export-pdf { background: #1e293b; color: #ffffff; font-weight: 600; font-size: 0.8rem; padding: 0.55rem 0.5rem; border-radius: 6px; border: none; cursor: pointer; text-align: center; }
.btn-export-pdf:hover { background: #0f172a; }
.btn-export-excel { background: #065f46; color: #ffffff; font-weight: 600; font-size: 0.8rem; padding: 0.55rem 0.5rem; border-radius: 6px; border: none; cursor: pointer; text-align: center; }
.btn-export-excel:hover { background: #047857; }

.math-details { margin-top: 0.75rem; }
.math-details summary { cursor: pointer; color: var(--primary); font-size: 0.8rem; font-weight: 700; user-select: none; }
.math-box { background: #1e293b; color: #cbd5e1; padding: 0.75rem; border-radius: 4px; margin-top: 0.4rem; font-family: monospace; font-size: 0.75rem; white-space: pre-wrap; overflow-x: auto; }

/* Карточка ГОСТ - ИСПРАВЛЕНИЕ СЪЕХАВШЕГО ТЕКСТА БЕЙДЖА */
.gost-card { background: #ffffff; border-left: 4px solid var(--primary); }
.gost-header { display: flex; justify-content: space-between; align-items: center; }

#gostBadgeContainer {
    margin: 0.45rem 0;
    width: 100%;
}

#gostBadgeContainer .badge {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.35;
    display: block;
    width: 100%;
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
    text-align: left;
    box-sizing: border-box;
    border-radius: 6px;
}

.gost-text-block {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.45;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.65rem;
    margin-top: 0.4rem;
}

/* Шаблоны серий */
.control-card { display: flex; flex-direction: column; gap: 0.65rem; }
.card-section-title { font-size: 0.85rem; font-weight: 700; color: var(--text-main); }
.preset-cat-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; background: #f1f5f9; padding: 0.25rem; border-radius: 6px; margin-bottom: 0.6rem; }
.preset-tab-btn { border: none; background: transparent; padding: 0.35rem 0.2rem; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); border-radius: 4px; cursor: pointer; transition: all 0.15s ease-in-out; text-align: center; }
.preset-tab-btn:hover { color: var(--text-main); }
.preset-tab-btn.active { background: #ffffff; color: var(--primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.preset-items-stack { display: flex; flex-direction: column; gap: 0.4rem; }
.preset-item-card { display: flex; justify-content: space-between; align-items: center; background: #ffffff; border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.65rem; cursor: pointer; text-align: left; transition: all 0.15s ease-in-out; }
.preset-item-card:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.preset-item-card.is-active { border-color: var(--primary); background: var(--primary-light); border-left: 4px solid var(--primary); }
.preset-item-content { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.preset-item-code { font-size: 0.68rem; font-weight: 700; color: var(--primary); text-transform: uppercase; }
.preset-item-title { font-size: 0.8rem; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-check-icon { color: var(--primary); font-weight: 800; font-size: 0.95rem; margin-left: 0.5rem; }

/* Сводка по элементам */
.summary-list-card { display: flex; flex-direction: column; }
.summary-list-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-bottom: 0.6rem; }
.summary-list-header h3 { font-size: 0.95rem; margin: 0; }
.results-scroll-area { display: flex; flex-direction: column; gap: 0.5rem; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.result-item { padding: 0.5rem 0; border-bottom: 1px dashed var(--border); }
.result-item:last-child { border-bottom: none; }
.result-header { display: flex; justify-content: space-between; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.2rem; }

/* Аккордеон элементов в левой колонке */
.elements-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.accordion-card { padding: 0; overflow: hidden; transition: border-color 0.2s; border-left: 5px solid var(--border); }
.accordion-card.state-green { border-left-color: var(--state-green); }
.accordion-card.state-yellow { border-left-color: var(--state-yellow); }
.accordion-card.state-orange { border-left-color: var(--state-orange); }
.accordion-card.state-red { border-left-color: var(--state-red); }

.accordion-header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1.1rem; cursor: pointer; user-select: none; background: #ffffff; transition: background-color 0.15s; }
.accordion-card.is-collapsed .accordion-header { background: #f8fafc; }
.accordion-header:hover { background-color: var(--primary-light); }
.header-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.accordion-chevron { font-size: 0.8rem; color: var(--primary); width: 12px; }
.accordion-title { font-size: 1rem; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.accordion-body { padding: 0 1.1rem 1.1rem 1.1rem; border-top: 1px solid #f1f5f9; }

/* Формы */
.form-row { display: flex; gap: 0.75rem; margin-bottom: 0.65rem; }
.form-group { flex: 1; min-width: 0; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 600; font-size: 0.8rem; color: var(--text-muted); }
select, input[type="number"], input[type="text"] { width: 100%; padding: 0.5rem; border: 1px solid var(--border); border-radius: 4px; font-size: 0.88rem; }
select:focus, input:focus { outline: none; border-color: var(--primary); }

/* Фильтры и теги */
.filters-row { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; background: #f1f5f9; padding: 0.6rem; border-radius: 6px; }
.search-filter-box input { background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; padding: 0.45rem 0.65rem; font-size: 0.85rem; }
.tags-container { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag-filter-btn { background: #ffffff; border: 1px solid #cbd5e1; color: #475569; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.55rem; border-radius: 4px; cursor: pointer; }
.tag-filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.tag-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }

/* Зоны и дефекты */
.zone-list { display: flex; flex-direction: column; gap: 0.85rem; }
.zone-item { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.6rem; }
.zone-top-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.5rem; }
.zone-number-title { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.zone-area-group { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; }
.zone-area-group input { width: 95px; padding: 0.3rem 0.5rem; }
.defects-cards-container { display: flex; flex-direction: column; gap: 0.45rem; }

.defect-choice-card { background: #ffffff; border: 1px solid #e2e8f0; border-left: 4px solid var(--border); border-radius: 6px; padding: 0.65rem 0.75rem; cursor: pointer; transition: all 0.15s ease-in-out; }
.defect-choice-card.state-green { border-left-color: var(--state-green); }
.defect-choice-card.state-yellow { border-left-color: var(--state-yellow); }
.defect-choice-card.state-orange { border-left-color: var(--state-orange); }
.defect-choice-card.state-red { border-left-color: var(--state-red); }
.defect-choice-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.06); background: #fcfdfe; }
.defect-choice-card.selected { border-color: var(--primary); border-left-width: 6px; background: var(--primary-light); }

.defect-choice-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.defect-radio-label { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; line-height: 1.35; }
.defect-radio-label input[type="radio"] { margin-top: 0.15rem; accent-color: var(--primary); cursor: pointer; }
.defect-name-title { font-weight: 500; color: #0f172a; }
.defect-subtext { margin-top: 0.3rem; padding-left: 1.4rem; font-size: 0.75rem; color: #475569; }
.defect-subtext-works { margin-top: 0.2rem; padding-left: 1.4rem; font-size: 0.75rem; color: #047857; }
.defect-selected-options { margin-top: 0.45rem; padding-top: 0.45rem; padding-left: 1.4rem; border-top: 1px dashed #99f6e4; }

/* Режимы определения износа */
.mode-pills-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.mode-pill-label { display: inline-flex; align-items: center; background: #ffffff; border: 1px solid #cbd5e1; padding: 0.25rem 0.55rem; border-radius: 4px; font-size: 0.76rem; font-weight: 600; color: #475569; cursor: pointer; transition: all 0.15s; }
.mode-pill-label:hover { border-color: var(--primary); color: var(--primary); }
.mode-pill-label.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.mode-pill-label input[type="radio"] { display: none; }

.auto-interp-card { background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 6px; padding: 0.65rem 0.85rem; margin-top: 0.4rem; }
.interp-input-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.unit-badge { background: #ccfbf1; color: #0f766e; font-size: 0.78rem; font-weight: 700; padding: 0.3rem 0.5rem; border-radius: 4px; border: 1px solid #99f6e4; white-space: nowrap; }
.interp-calc-proof { margin-top: 0.45rem; padding-top: 0.45rem; border-top: 1px dashed #99f6e4; font-size: 0.78rem; color: #0f172a; line-height: 1.4; }
.interp-disabled-card { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 0.6rem 0.75rem; color: #92400e; font-size: 0.8rem; line-height: 1.4; margin-top: 0.4rem; }

/* Мастер слоистых конструкций и инженерии */
.layered-container { max-width: 1300px; margin: 0 auto; }
.layered-wizard-card { padding: 1.5rem; }
.wizard-header h2 { font-size: 1.4rem; color: var(--text-main); }
.wizard-subtitle { font-size: 0.88rem; color: var(--text-muted); margin-top: 0.25rem; max-width: 950px; line-height: 1.45; }
.wizard-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; margin-top: 1.5rem; align-items: flex-start; }
.wizard-inputs-pane { display: flex; flex-direction: column; gap: 1rem; }
.wizard-step-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 0.85rem 1rem; }
.step-badge { display: inline-block; background: var(--primary); color: #ffffff; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 3px; text-transform: uppercase; margin-bottom: 0.3rem; }
.step-label { display: block; font-size: 0.88rem; font-weight: 700; color: #1e293b; }
.normative-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; font-style: italic; }
.canvas-box-layered { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.5rem; display: flex; justify-content: center; }
.layered-verdict-box { border-left: 4px solid var(--primary); }

/* Полное описание дефекта в слоистых конструкциях */
.layered-defect-info-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Индикатор контроля 100% */
.control-100-badge-box {
    margin-top: 0.85rem;
    padding: 0.75rem 1rem;
    background: #ecfdf5;
    border: 2px solid #059669;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    color: #065f46;
}

/* Бейджи */
.badge { padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.75rem; font-weight: 700; border: 1px solid transparent; }
.badge-green { background: var(--state-green-bg); color: var(--state-green); border-color: #a7f3d0; }
.badge-yellow { background: var(--state-yellow-bg); color: var(--state-yellow); border-color: #fde68a; }
.badge-orange { background: var(--state-orange-bg); color: var(--state-orange); border-color: #fed7aa; }
.badge-red { background: var(--state-red-bg); color: var(--state-red); border-color: #fecaca; }
.badge-subtle { background: #f1f5f9; color: #64748b; font-weight: 600; border-color: #e2e8f0; }

/* Кнопки */
.btn { background-color: var(--primary); color: white; border: none; padding: 0.45rem 0.85rem; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 0.8rem; }
.btn:hover { background-color: var(--primary-hover); }
.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-outline { background: transparent; border: 1px dashed var(--primary); color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); padding: 0.25rem 0.5rem; border: 1px solid transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.btn-add-main { width: 100%; padding: 0.75rem; border: 2px dashed var(--border); background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 8px; font-size: 0.9rem; }
.btn-add-main:hover { border-color: var(--primary); color: var(--primary); background: #f0fdfa; }
.btn-text-action { background: none; border: none; color: var(--primary); font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; }
.btn-text-action:hover { color: var(--primary-hover); }

/* Предупреждение о весах */
.weight-warning-box { margin-top: 0.6rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: 0.5rem; text-align: center; }
#weightWarningText { color: var(--danger); font-size: 0.75rem; font-weight: 700; margin-bottom: 0.35rem; }
.btn-balance { background: #ffffff; color: var(--danger); border: 1px solid var(--danger); padding: 0.25rem 0.5rem; font-size: 0.75rem; font-weight: 700; border-radius: 4px; width: 100%; cursor: pointer; }
.btn-balance:hover { background: var(--danger); color: #ffffff; }

/* Пустое состояние */
.empty-state-card { background: #ffffff; border: 2px dashed #cbd5e1; border-radius: 12px; padding: 2.5rem 1.5rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.empty-state-icon { font-size: 2.5rem; }
.empty-state-card h3 { font-size: 1.15rem; color: var(--text-main); }
.empty-state-card p { font-size: 0.85rem; color: var(--text-muted); max-width: 450px; line-height: 1.4; margin-bottom: 0.5rem; }
.empty-state-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* Дефектная ведомость */
.statement-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
.statement-table-box { overflow-x: auto; }
.statement-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.statement-table th, .statement-table td { border: 1px solid var(--border); padding: 0.6rem 0.75rem; vertical-align: top; }
.statement-table th { background: #f1f5f9; font-weight: 700; color: var(--text-main); text-align: left; }
.statement-table tr:hover { background: #f8fafc; }
.works-cell { color: #065f46; font-weight: 500; }

/* Модальное окно печатного акта */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15, 23, 42, 0.6); display: flex; justify-content: center; align-items: center; z-index: 9999; padding: 1rem; }
.modal-container { background: #ffffff; width: 100%; max-width: 950px; max-height: 90vh; border-radius: 8px; display: flex; flex-direction: column; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2); overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--border); background: #f8fafc; }
.print-document-body { background: #ffffff; color: #000000; padding: 2rem; font-family: 'Times New Roman', Times, serif; line-height: 1.35; overflow-y: auto; }

.act-header-normative { text-align: right; font-size: 0.85rem; margin-bottom: 1rem; }
.act-title-main { text-align: center; font-size: 1.25rem; font-weight: bold; margin-bottom: 1.25rem; }
.act-object-props { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; font-size: 0.9rem; }
.props-row { display: flex; align-items: center; }
.props-label { font-weight: bold; margin-right: 0.5rem; min-width: 140px; }
.props-input { border: none; border-bottom: 1px solid #000000; font-family: inherit; font-size: inherit; padding: 0.1rem 0.25rem; flex: 1; background: transparent; }
.props-input:focus { outline: none; border-bottom: 2px solid var(--primary); }

.act-vsn-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; margin-bottom: 1rem; font-size: 0.85rem; }
.act-vsn-table th, .act-vsn-table td { border: 1px solid #000000; padding: 0.4rem 0.5rem; }
.act-vsn-table th { background: #f8fafc; font-weight: bold; text-align: center; }
.tr-total { background: #f1f5f9; }
.act-verdict-box { margin-top: 0.75rem; font-size: 0.95rem; padding: 0.6rem; border: 1px solid #000000; background: #fafafa; }
.emergency-border { border: 2px solid #dc2626 !important; background: #fff5f5 !important; }

.act-signatures-block { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.signature-line-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sig-role { border: none; border-bottom: 1px solid #000000; flex: 1; font-family: inherit; font-size: inherit; padding: 0.1rem; }
.sig-space { font-family: inherit; font-size: 0.9rem; white-space: nowrap; }

/* МОДУЛЬ АНАЛИТИКИ */
.analytics-container { max-width: 1400px; margin: 0 auto; }
.analytics-hero-card { background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); border-top: 4px solid var(--primary); }
.analytics-hero-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.analytics-hero-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.kpi-cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.kpi-metric-card { background: #ffffff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; display: flex; flex-direction: column; align-items: center; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.kpi-title { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.kpi-value { font-size: 2.2rem; font-weight: 800; line-height: 1.1; margin: 0.3rem 0; color: #1e293b; }
.kpi-subtext { font-size: 0.72rem; color: var(--text-muted); }
.kpi-val-success { color: #059669 !important; }
.kpi-val-warning { color: #d97706 !important; }
.kpi-val-danger { color: #dc2626 !important; }

.readiness-progress-wrapper { background: #ffffff; border: 1px solid var(--border); border-radius: 6px; padding: 0.75rem 1rem; }
.readiness-bar-track { width: 100%; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.readiness-bar-fill { height: 100%; transition: width 0.4s ease-in-out; }

.audit-columns-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.audit-col { background: #f8fafc; border-radius: 8px; padding: 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; border: 1px solid var(--border); }
.audit-col-danger { border-top: 3px solid #dc2626; }
.audit-col-warning { border-top: 3px solid #f59e0b; }
.audit-col-info { border-top: 3px solid #3b82f6; }
.audit-col-title { font-size: 0.85rem; font-weight: 700; color: #1e293b; }
.audit-items-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 280px; overflow-y: auto; }
.audit-item { background: #ffffff; border: 1px solid var(--border); border-radius: 6px; padding: 0.55rem 0.75rem; font-size: 0.8rem; cursor: pointer; transition: all 0.15s; }
.audit-item:hover { transform: translateX(2px); }
.audit-item-err { border-left: 4px solid #dc2626; }
.audit-item-warn { border-left: 4px solid #f59e0b; }
.audit-item-info { border-left: 4px solid #3b82f6; cursor: default; }
.audit-item-head { display: flex; justify-content: space-between; align-items: center; color: #0f172a; font-size: 0.78rem; }
.audit-item-head span { font-size: 0.7rem; color: var(--primary); font-weight: 700; }
.audit-item-desc { margin-top: 0.2rem; font-size: 0.75rem; color: #475569; line-height: 1.35; }
.audit-item-empty { font-size: 0.78rem; color: var(--text-muted); font-style: italic; padding: 0.5rem 0; }

.analytics-charts-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.25rem; align-items: flex-start; }
.analytics-left-col, .analytics-right-col { display: flex; flex-direction: column; gap: 1.25rem; }
.chart-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.chart-bars-stack { display: flex; flex-direction: column; gap: 0.45rem; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.chart-bar-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; cursor: pointer; padding: 0.25rem 0.35rem; border-radius: 4px; transition: background 0.15s; }
.chart-bar-row:hover { background: #f1f5f9; }
.chart-bar-label { width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; color: #1e293b; }
.chart-bar-track { flex: 1; height: 12px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 6px; transition: width 0.3s; }
.chart-bar-value { width: 75px; text-align: right; font-weight: 700; }

.defects-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.45rem; }
.defect-stat-chip { background: #f8fafc; border: 1px solid var(--border); padding: 0.45rem 0.65rem; border-radius: 6px; font-size: 0.78rem; color: #334155; }
.whatif-card { background: #f0f7ff; border: 1px solid #bfdbfe; }
.whatif-controls-box { display: flex; flex-direction: column; gap: 0.35rem; }
.whatif-radio-label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; color: #1e3a8a; cursor: pointer; }
.whatif-flex-metric { display: flex; justify-content: space-between; align-items: center; background: #ffffff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 0.65rem 1rem; margin-top: 0.6rem; text-align: center; }
.attention-bullet-item { font-size: 0.78rem; padding: 0.35rem 0; border-bottom: 1px dashed #fef3c7; line-height: 1.35; }
.attention-bullet-item:last-child { border-bottom: none; }

.highlight-pulse { animation: pulseBorder 1s infinite alternate; }
@keyframes pulseBorder {
    from { box-shadow: 0 0 0 2px var(--primary); }
    to { box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.4); }
}

/* Правила печати: скрываем интерфейс, печатаем только бланк */
@media print {
    body { background: #ffffff !important; padding: 0 !important; margin: 0 !important; }
    .no-print, .container, .tabs, .app-top-header { display: none !important; }
    .modal-overlay { position: static !important; background: none !important; padding: 0 !important; display: block !important; }
    .modal-container { box-shadow: none !important; max-width: 100% !important; max-height: none !important; border: none !important; }
    .print-document-body { padding: 0 !important; font-size: 11pt !important; }
    .act-vsn-table th { background: #e5e5e5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .props-input, .sig-role { border-bottom: 1px solid #000 !important; }
}

@media (max-width: 1024px) {
    .layout { flex-direction: column; }
    .right-panel { position: static; width: 100%; max-height: none; }
    .wizard-grid { grid-template-columns: 1fr; }
    .kpi-cards-grid { grid-template-columns: repeat(2, 1fr); }
    .audit-columns-grid { grid-template-columns: 1fr; }
    .analytics-charts-grid { grid-template-columns: 1fr; }
}