 #p2 {
     display: grid;
     grid-template-areas:
         "spinner "
         "form "
         "position"
     ;
     grid-template-rows: auto auto auto;
     margin: 0 auto;
     gap: 5px;
     height: auto;
     align-items: start;
     justify-items: start;
     margin: 0 auto;

 }

 #preloader {
     position: fixed;
     top: 0;
     left: 0;
     right: 0;
     bottom: 0;
     background-color: transparent;
     display: flex;
     justify-content: center;
     align-items: center;
     z-index: 9999;
 }

 .spinner {
     width: 50px;
     height: 50px;
     border: 5px solid var(--color-gray-light);
     border-top-color: var(--color-primary);
     border-radius: 50%;
     animation: spin 1s linear infinite;
 }

 @keyframes spin {
     0% {
         transform: rotate(0deg);
     }

     100% {
         transform: rotate(360deg);
     }
 }

 #form1 {
     grid-area: form;
     display: grid;
     grid-template-columns: 1fr 1fr minmax(0, 2fr);
     gap: 6px;

     border-radius: 8px;
     padding: 6px;
 }

 #col1,
 #col2,
 #col3 {
     position: relative;
     display: flex;
     flex-direction: column;
     height: 50vh;
     background: var(--color-white);
     border: 1px solid var(--color-gray-dark);
     border-radius: 12px;
     overflow: visible;
     box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
     box-sizing: border-box;


 }

 #col1 h3,
 #col2 h3,
 #col3 h3 {
     position: sticky;
     top: 0;
     z-index: 10;
     margin: 0;
     padding: 10px 12px;
     background: var(--color-gray-light);
     color: var(--color-gray-dark);
     border-bottom: 1px solid var(--color-gray-medium);
     text-align: center;
     border-top-right-radius: 12px;
     border-top-left-radius: 12px;

 }

 #col3 h4 {
     margin: 0;
     padding: 6px 12px;
     background: var(--color-gray-light);
     border-bottom: 1px solid var(--color-gray-medium);
     color: var(--color-gray-dark);
 }

 #col1> :not(h3):not(.card-footer),
 #col2> :not(h3):not(.card-footer),
 #col3> :not(h3):not(h4):not(.card-footer) {
     flex: 1;
     overflow-y: auto;
     padding: 8px;
     background: var(--color-gray-light-light);
 }

 .card-footer {
     height: 34px;

     background: linear-gradient(to bottom,
             var(--color-gray-light),
             var(--color-gray-medium));

     border-top: 1px solid var(--color-gray-medium);
     border-bottom-left-radius: 12px;
     border-bottom-right-radius: 12px;

 }

 #navpanel {
     grid-area: navpanel;
     border: 1px solid var(--color-primary);
     border-radius: 5px;
 }


 #position {
     grid-area: position;
     border-radius: 15px;
     background: var(--color-gray-light-light);
     padding: 5px;
     width: 100%;
 }

 #position h3 {
     text-align: center;
 }

 .method_table {
     width: 100%;
 }

 #table-datalist {
     width: 100%;
     border-collapse: separate;
 }

 #table-datalist tr {
     background-color: var(--color-gray-light-light);
     transition: background-color 0.15s ease;
 }

 #table-datalist tr:hover {
     background-color: var(--color-hover);
 }

 #table-datalist td,
 #table-datalist th {
     padding: 6px 8px;
     border: 1px solid var(--color-gray-medium);
     vertical-align: middle;
     text-align: center;
 }

 .section-header {
     cursor: pointer;
     text-align: left;
     border-radius: 5px;
 }

 .section-header div {
     padding: 10px 14px;
 }

 .active-section {
     box-shadow: inset 4px 0 0 var(--color-accent);
 }

 .datalist_name,
 .datalist_value,
 .smetaHeader_field {
     min-height: 32px;
     padding: 6px 8px;
     border: 1px solid var(--color-gray-light);
     border-radius: 6px;
     outline: none;
     background-color: var(--color-gray-light-light);
     transition: border-color 0.15s ease, background-color 0.15s ease;
 }

 .datalist_name {
     text-align: left;
 }

 .datalist_value {
     text-align: right;
 }

 .datalist_name:focus,
 .datalist_value:focus,
 .smetaHeader_field:focus,
 .section-header:focus {
     border-color: var(--color-gray-medium);
     background-color: var(--color-white);
 }

 .section-total {
     background-color: var(--color-gray-light);
 }

 .section-total td {
     border-top: 2px solid var(--color-gray-light);
 }

 .locsmeta_secsummary {
     text-align: right;
 }

 .locsmeta_summary {
     text-align: right;
 }

 #table-datalist button {
     padding: 4px 8px;
     border-radius: 6px;
     border: 1px solid var(--color-gray-medium);

 }

 .apply-row {
     color: var(--color-primary);
     cursor: pointer;
 }

 .delete-row {
     color: var(--color-red);
     cursor: pointer;
 }

 .move-row {
     color: var(--color-accent);
     cursor: grab;
 }

 .calc-formula {
     min-width: 100px;
 }

 .openModalBtn {
     color: var(--color-primary);
     cursor: pointer;
 }

 .open-method-modal {
     color: var(--color-primary);
     cursor: pointer;
 }

 .styled-table {
     width: 100%;
     color: var(--color-gray-dark);
 }

 .styled-table th {
     padding: 8px;
     text-align: left;
     border-bottom: 1px solid var(--color-gray-medium);
 }

 .styled-table td {
     padding: 8px;
     text-align: left;
     border: 1px solid var(--color-gray-medium);
     

 }

 .styled-table .block-header {
     font-weight: bold;
 }

 .styled-table tbody tr.block-header:hover {
     background-color: var(--color-blue-light);
     color: var(--color-white);
     cursor: pointer;
 }

 .block-header th {
     border-bottom-color: var(--color-gray-medium);
 }

 .block-arrow {
     display: inline-block;
     width: 16px;
     margin-right: 4px;
     transition: transform 0.2s;
 }

 .checkbox_pr {
     width: 22px;
     height: 22px;
     cursor: pointer;
     accent-color: var(--color-primary);
     vertical-align: middle;
 }

 .checkbox_pr:hover {
     transform: scale(1.1);
     transition: transform 0.1s;
 }

 .select-wrapper {
     background: var(--color-gray-light-light);
     color: var(--color-gray-dark);
 }

 .select-wrapper ul {
     margin: 0;
     padding: 0;
     list-style: none;
 }

 #names_collection li,
 #name_tables li {
     list-style: none;
     display: flex;
     align-items: center;
     gap: 6px;
     padding: 6px 6px;
     cursor: pointer;
     line-height: 1.5;
     border-bottom: 1px solid var(--color-gray-medium);
     transition: background 0.2s, color 0.2s, font-weight 0.2s;
 }


 #names_collection li::before,
 #name_tables li::before {
     position: static;
     transform: none;
     flex-shrink: 0;
 }

 #names_collection li::before {
     content: attr(data-icon);
 }

 #name_tables li::before {
     content: "➤";
     color: var(--color-primary);
 }


 #names_collection li:hover,
 #name_tables li:hover {
     background: var(--color-blue-light);
     color: var(--color-white);
     border-radius: 10px;
 }


 #names_collection li.selected,
 #name_tables li.selected {
     background: var(--color-primary-light);
     color: var(--color-white);
     font-weight: bold;
     border-radius: 10px;
 }

 .coef-modal {
     width: min(900px, 95vw);
     max-height: 90vh;
     border-radius: 12px;
     background: var(--color-white);
     padding: 0;
     margin: 0;
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     z-index: 1000;
 }

 .coef-modal::backdrop {
     background: rgba(0, 0, 0, 0.45);
     backdrop-filter: blur(3px);
 }

 .modal-box {
     margin: 10px;
     display: flex;
     flex-direction: column;
     height: 100%;
 }

 .modal-box .hidden {
     opacity: 0;
     display: none;
 }

 .modal-tabs {
     display: flex;
     margin: 0;
     padding: 0;
 }

 .modal-tabs button {
     flex: 1;
     padding: 10px 8px;
     background: transparent;
     border: none;
     cursor: pointer;
     border-right: 1px solid var(--color-gray-medium);
     transition: 0.2s;
 }

 .modal-tabs button:last-child {
     border-right: none;
 }

 .modal-tabs button.active {
     background: var(--color-primary);
     font-weight: 600;
     color: var(--color-white);
 }

 .modal-tabs button:hover {
     background: var(--color-blue-light);
 }

 .modal-body {
     flex: 1 1 auto;
     overflow-y: auto;
     padding: 15px;
 }

 .tab {
     display: none;
 }

 .tab.active {
     display: block;
 }

 .modal-body table {
     width: 100%;
     background: var(--color-white);
 }

 .modal-body th,
 .modal-body td {
     border: 1px solid var(--color-gray-light);
     padding: 6px 8px;
     vertical-align: top;
 }

 .modal-body th {
     background: var(--color-gray-light-light);
     font-weight: 600;
 }


 .modal-footer {
     position: sticky;
     bottom: 0;
     flex-shrink: 0;
     display: flex;
     justify-content: flex-end;
     padding: 10px;
     gap: 10px;
     border-top: 1px solid #ddd;
     background: var(--color-gray-light);
 }

 .modal-footer button {
     padding: 6px 14px;
     border-radius: 6px;
     border: none;
     cursor: pointer;
     transition: 0.2s;
 }

 .modal-footer button[value="close"] {
     background: var(--color-gray-light-light);
 }

 .modal-footer button:not([value="close"]) {
     background: var(--color-primary-light);
     color: var(--color-white);
 }

 .block-header-rel-coef,
 .block-header-st-coef,
 .block-header-rel-sect-coef {
     background-color: var(--color-gray-light);
     font-weight: bold;
 }

 .block-header-rel-coef:hover,
 .block-header-st-coef:hover,
 .block-header-rel-sect-coef:hover {
     background-color: var(--color-gray-light);
     cursor: pointer;
 }

 .block-header-rel-coef th,
 .block-header-st-coef th {
     border-bottom-color: var(--color-gray-light);
 }

 .st_coef,
 .g707_coef,
 .gl_coef,
 .loc_coef,
 .indms_coef,
 .user_coef,
 .rel_coef {
     width: 22px;
     height: 22px;
     cursor: pointer;
     accent-color: var(--color-primary);
     vertical-align: middle;
 }

 .st_coef:hover,
 .g707_coef:hover,
 .gl_coef:hover,
 .loc_coef:hover,
 .indms_coef:hover,
 .user_coef:hover,
 .rel_coef:hover {
     transform: scale(1.1);
     transition: transform 0.1s;
 }

 .modalSmetaHeader-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.45);
     display: none;
     z-index: 2000;
 }

 .modalSmetaHeader-window {
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     background: var(--color-white);
     max-height: 90vh;
     overflow-y: auto;
     padding: 20px;
     border-radius: 12px;
     box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
     display: none;
     z-index: 2001;
 }

 .modalSmetaHeader-close {
     position: absolute;
     top: 8px;
     right: 10px;
     background: none;
     border: none;
     cursor: pointer;
 }

 .smeta_header {
     display: flex;
     flex-direction: column;
     gap: 20px;
     min-width: 420px;
 }

 .smeta_header h3 {
     margin: 0;
     text-align: center;
     font-weight: 600;
     color: var(--color-gray-dark);
 }

 .table_header {
     width: 100%;
     border-collapse: separate;
     border-spacing: 0 10px;
 }

 .table_header td {
     padding: 6px 0;
     vertical-align: middle;
 }

 .table_header td:first-child {
     width: 40%;
     font-weight: 500;
     color: var(--color-gray-dark);
     padding-right: 10px;
 }

 .smetaHeader_field {
     width: 100%;
     min-height: 32px;
     padding: 6px 10px;
     background: var(--color-gray-light-light);
     border: 1px solid var(--color-gray-medium);
     border-radius: 6px;
     outline: none;
     transition: all 0.2s ease;
     white-space: nowrap;
     overflow-x: auto;
 }

 .smetaHeader_field:focus {
     background: var(--color-gray-light-light);
     border-color: var(--color-blue-light);
     box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
 }

 .modalSmetaEnding-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.45);
     display: none;
     z-index: 2000;
 }

 .modalSmetaEnding-window {
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     width: 40vw;
     max-width: 1200px;
     min-width: 600px;
     max-height: 90vh;
     overflow-y: auto;
     background: var(--color-gray-light-light);
     padding: 10px;
     border-radius: 12px;
     box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
     display: none;
     z-index: 2001;
 }

 #table_ending_2p {
     width: 100%;
 }

 #table_ending_2p tr {
     width: 100%;
 }

 #table_ending_2p td {
     padding: 4px;
     vertical-align: middle;
 }

 #table_ending_2p td:first-child {
     width: 30px;
     text-align: center;
 }

 #table_ending_2p td:last-child {
     width: 60px;
 }

 #table_ending_2p td:nth-child(2) {
     width: auto;
 }

 #table_ending_2p input {
     box-sizing: border-box;
     height: 32px;
 }

 .input_ending_1 {
     width: 100%;
 }

 .input_ending_2 {
     width: 100%;
     text-align: center;
 }

 .ending,
 .ending_nds {
     width: 22px;
     height: 22px;
     cursor: pointer;
 }

 .panel-buttons {
     display: flex;
     justify-content: flex-end;
     gap: 10px;
     margin-top: 10px;
 }

 .input_ending_1,
 .input_ending_2 {
     padding: 6px 8px;
     border-radius: 6px;
     border: 1px solid transparent;
     min-height: 32px;
     line-height: 20px;
     outline: none;
     transition: border 0.15s, box-shadow 0.15s, background 0.15s;
     color: var(--color-gray-dark)
 }

 .input_ending_1:focus,
 .input_ending_2:focus {
     border: 1px solid var(--color-blue-light);
     box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
     background: var(--color-white);
 }

 .ending,
 .endingIndex,
 .ending_nds {
     width: 20px;
     height: 20px;
     accent-color: var(--color-blue-light);
 }

 .panel-buttons button {
     padding: 8px 14px;
     border-radius: 8px;
     border: 1px solid transparent;
     cursor: pointer;
     transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
 }

 .btn-cancel {
     background: var(--color-gray-light-light);
     color: var(--color-gray-dark);
 }

 .btn-cancel:hover {
     background: var(--color-gray-light);
 }

 .btn-apply {
     background: var(--color-primary);
     color: var(--color-white);
 }

 .btn-apply:hover {
     background: var(--color-blue-light);
     box-shadow: 0 4px 10px rgba(13, 110, 253, 0.35);
 }

 .btn-apply:active {
     transform: translateY(1px);
 }

 [contenteditable][data-placeholder]:empty::before {
     content: attr(data-placeholder);
     color: var(--color-gray-dark);
     pointer-events: none;
 }

 #table_ending_2p tr:has(input:checked) {
     background: var(--color-gray-light) !important;
 }

 .coef-select {
     position: relative;
     width: 100%;
     user-select: none;
 }

 .coef-select__value {
     padding: 6px 10px;
     border: 1px solid var(--color-gray-dark);
     border-radius: 6px;
     background: var(--color-gray-light);
     cursor: pointer;
 }

 .coef-select__value::after {
     content: "▾";
     float: right;
     color: var(--color-gray-light);
 }

 .coef-select.open .coef-select__value {
     border-color: var(--color-blue-light);
     box-shadow: 0 0 0 2px rgba(13, 110, 253, .15);
 }

 .coef-select__dropdown {
     position: absolute;
     top: 100%;
     left: 0;
     right: 0;
     background: var(--color-gray-light-light);
     border: 1px solid var(--color-gray-dark);
     border-radius: 6px;
     margin-top: 4px;
     max-height: 200px;
     overflow-y: auto;
     display: none;
     z-index: 10;
 }

 .coef-select.open .coef-select__dropdown {
     display: block;
 }

 .coef-option {
     padding: 6px 10px;
     cursor: pointer;
 }

 .coef-option:hover {
     background: var(--color-gray-light);
 }

 .drag-active {
     opacity: 0.6;
     background: var(--color-gray-medium);
 }

 .drag-placeholder {
     background: #f0f0f0;
     border: 2px dashed var(--color-blue-light);
     animation: placeholderBlink 0.8s infinite ease-in-out;
     height: 48px;
 }

 #datalist tr {
     transition: transform 0.18s ease;
 }

 .drag-placeholder+tr {
     transform: translateY(6px);
 }

 tr.drag-active+.drag-placeholder {
     transform: translateY(-6px);
 }

 @keyframes placeholderBlink {
     0% {
         opacity: 0.55;
     }

     50% {
         opacity: 1;
     }

     100% {
         opacity: 0.55;
     }
 }

 .modalSmeta-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.45);
     display: none;
     z-index: 2000;
 }

 .modalSmeta-window {
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     background: white;
     max-width: 90vw;
     border-radius: 12px;
     box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
     display: none;
     z-index: 2001;
     overflow: hidden;
 }

 .modalSmeta-window-header {
     position: sticky;
     top: 0;
     z-index: 10;
     background: var(--color-gray-light);
     padding: 12px 20px;
     border-bottom: 1px solid var(--color-gray-medium);
     display: flex;
     align-items: center;
     justify-content: space-between;
     gap: 16px;
 }

.modalSmeta-window-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modalSmeta-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Кнопка Excel */
.modalSmeta-excel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: #1d6f42;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.modalSmeta-excel:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    opacity: 0.95;
}

.modalSmeta-excel .icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Кнопка закрытия */
.modalSmeta-close {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #fff;
    color: #444;
    font-size: 18px;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.modalSmeta-close:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

 .modalSmeta-window-body,
 .modalSmeta-sur-window-body {
     max-height: calc(90vh - 60px);
     overflow-y: auto;
     padding: 20px;
 }

 #smeta table {
     width: 100%;
 }

 #smeta td {
     padding: 6px 8px;
     border: none;
     vertical-align: middle;
 }

 #smeta td[colspan="5"] {
     text-align: center;
     border: none;
 }

 .native-modal {
     width: min(900px, 95vw);
     max-height: 90vh;
     border-radius: 12px;
     background: var(--color-white);
     padding: 0;
     margin: 0;
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     z-index: 1000;
 }

 .native-modal::backdrop {
     background: rgba(0, 0, 0, 0.45);
     backdrop-filter: blur(3px);
 }

 .native-modal-content {
     display: flex;
     flex-direction: column;
     padding: 20px;
     gap: 20px;
 }

 .native-modal-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     border-bottom: 1px solid var(--color-gray-light);
     padding-bottom: 10px;
 }

 .native-modal-header h3 {
     margin: 0;
     color: var(--color-gray-dark);
 }

 .modal-close {
     background: none;
     border: none;
     cursor: pointer;
     line-height: 1;
 }

 .native-modal-body {
     overflow-x: auto;
 }

 .mk {
     width: 60px;
     padding: 4px 6px;
     border: 1px solid var(--color-gray-dark);
     border-radius: 6px;
     outline: none;
     transition: all 0.2s ease;
 }

 .mk:focus {
     border-color: var(--color-blue-light);
     box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
 }

 .native-modal-footer {
     display: flex;
     justify-content: flex-end;
     gap: 10px;
     border-top: 2px solid var(--color-gray-light);
     padding-top: 15px;
 }

 .native-modal-footer button {
     padding: 8px 16px;
     font-weight: 600;
     border-radius: 6px;
     cursor: pointer;
     border: none;
     transition: all 0.2s ease;
 }

 .native-modal-footer .btn-secondary {
     background: var(--color-gray-light);
     color: var(--color-gray-dark);
 }

 .native-modal-footer .btn-secondary:hover {
     background: var(--color-gray-light-light);
 }

 .native-modal-footer .apply-method {
     background: var(--color-primary);
     color: var(--color-white);
 }

 .native-modal-footer .apply-method:hover {
     background: var(--color-blue-light);
 }


 .calc {
     transform: scale(1.5);
     margin-right: 10px;
     cursor: pointer;
     vertical-align: middle;
 }

 .active-section {
     background-color: var(--color-white);
     border-left: 3px solid var(--color-blue-light);

 }

 .modalMS-window {
     position: fixed;
     top: 50%;
     left: 50%;
     transform: translate(-50%, -50%);
     width: 40vw;
     max-width: 1200px;
     min-width: 600px;
     max-height: 90vh;
     overflow-y: auto;
     background: var(--color-white);
     padding: 10px;
     border-radius: 12px;
     box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
     display: none;
     z-index: 2001;
 }

 #table_indexMS {
     width: 100%;
 }

 #table_indexMS td {
     padding: 4px;
     vertical-align: middle;
 }

 .indexMS_checkbox {
     width: 22px;
     height: 22px;
     cursor: pointer;
 }

 .input_indexMS_2 {
     width: 100%;
     text-align: center;
 }

 .coef-select {
     cursor: pointer;
     user-select: none;
     border: 1px solid var(--color-gray-light);
     border-radius: 6px;
     padding: 6px;
     background: #f9f9f9;
 }

 .coef-select__dropdown {
     display: none;
     position: absolute;
     background: var(--color-gray-light-light);
     border: 1px solid var(--color-gray-medium);
     margin-top: 2px;
     max-height: 200px;
     overflow-y: auto;
     z-index: 3000;
 }

 .coef-dropdown {
     padding: 5px;
 }

 .coef-dropdown:hover {
     background-color: var(--color-gray-light);
 }

 .coef_sections_list {
     display: grid;
     grid-template-columns: repeat(2, 1fr);
     gap: 6px;
 }

 .rel-row.modified {
     background: var(--color-gray-medium);
 }

 .rel-row.modified td.rel_user_coef {
     font-weight: bold;
     color: var(--color-accent);
 }

 .rel-row.modified td.rel_result {
     font-weight: bold;
     color: var(--color-primary);
 }

 .access-tooltip {
     position: absolute;
     top: 40px;
     right: 10px;
     background: rgba(255, 235, 235, 0.95);
     color: var(--color-red);
     border: 1px solid var(--color-red);
     border-radius: 6px;
     padding: 8px 12px;
     font-size: 0.9rem;
     display: none;
     z-index: 100;
     max-width: 200px;
     overflow: hidden;
 }

 @media (max-width: 768px) {
     #form1 {
         grid-template-columns: 1fr 1fr;
     }

     #col3 {
         grid-column: 1 / -1;
     }

     #col1,
     #col2,
     #col3 {
         max-height: 300px;
         min-width: 0;
         overflow-y: auto;
     }
 }

 #search_results {
     flex: 1;
     overflow-y: auto;
     list-style: none;
     margin: 0;
     padding: 0;
 }

 #search_results li {
     padding: 5px;
     cursor: pointer;
 }

 #search_results li:hover {
     background: #eee;
 }

 mark {
     background: yellow;
 }

 .highlight-row {
     background: #ffe58a;
 }

 .block-header-highlight {
     background: #d3f9d8;
 }


 #left_panel {
     display: contents;
 }

 #search_panel {
     grid-column: 1 / 3;
     /* 🔥 занимает col1 + col2 */
 }

 #search_panel {
     position: relative;
     display: flex;
     flex-direction: column;
     height: 50vh;
     background: var(--color-white);
     border: 1px solid var(--color-gray-dark);
     border-radius: 12px;
     box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
     overflow: hidden;
 }

 #search_panel h3 {
     position: sticky;
     top: 0;
     z-index: 10;
     margin: 0;
     padding: 10px 12px;
     background: var(--color-gray-light);
     border-bottom: 1px solid var(--color-gray-medium);
     text-align: center;
 }

 .search-body {
     display: flex;
     flex-direction: column;
     flex: 1;
     padding: 8px;
     background: var(--color-gray-light-light);
     overflow: hidden;
 }

 #search_input {
     width: 100%;
     box-sizing: border-box;
     padding: 8px 10px;
     border-radius: 8px;
     border: 1px solid var(--color-gray-medium);
     margin-bottom: 8px;
     outline: none;
     font-size: 14px;
     flex: 0 0 auto;
 }

 #search_input:focus {
     border-color: var(--color-primary);
 }

 .action-cell {
    text-align: center;
    position: relative;
}

.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: #4caf50;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.add-btn:disabled {
    background: #cfcfcf;
    color: #888;
    cursor: not-allowed;
}

.add-btn[data-tip] {
    position: relative;
}

.add-btn[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: #222;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 1000;
}

.new-row-highlight {
    animation: rowHighlight 2.5s ease;
}

@keyframes rowHighlight {
    0% {
        background-color: #fff3a0;
    }
    70% {
        background-color: #fff8c7;
    }
    100% {
        background-color: transparent;
    }
}

.preview-cell {
    text-align: center;
    vertical-align: middle;
    background: #fafcff;
    min-width: 220px;
}

.preview-btn-table {
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    color: white;
    background:  #4caf50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    animation: previewPulse 2.2s infinite;
}

.preview-btn-table:hover {
    transform: scale(1.02);
}

@keyframes previewPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79,172,254,0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(79,172,254,0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79,172,254,0);
    }
}

.datalist-btn {
  position: relative;
}

.datalist-btn::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-gray-medium);
  color: var(--color-white);
  padding: 6px 10px;
  border: 1px solid var(--color-gray-dark);
  border-radius: 6px;
  white-space: normal;
  min-width: 160px;
  max-width: 240px;
  text-align: center;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 9999;
  box-sizing: border-box;
}

.datalist-btn:hover::after {
  opacity: 1;
}

.collection-item.selected {
    background: #d3f9d8;
    border-radius: 4px;
}