/* ============================================================
   CHERRYCRM — Пастельная элегантность
   ============================================================ */

:root {
    --primary: #4a6a7a;
    --primary-light: #6a8a9a;
    --primary-dark: #3a5a6a;
    --accent: #7a9a8a;
    --bg: #faf8f6;
    --card: #ffffff;
    --text: #2d3a3a;
    --text-secondary: #5a6a6a;
    --border: #e8e8e4;
    --success: #5a8a6a;
    --warning: #8a8a4a;
    --danger: #8a5a5a;
    --shadow: rgba(45, 45, 45, 0.06);
    --shadow-hover: rgba(45, 45, 45, 0.10);
    --radius: 12px;
    --transition: 0.3s ease;
}

/* ---------- КНОПКИ ---------- */
.btn-cherry {
    background: linear-gradient(135deg, #4a6a7a 0%, #6a8a9a 100%);
    color: #ffffff;
    font-weight: 500;
    padding: 10px 24px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 12px rgba(74, 106, 122, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.btn-cherry:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(74, 106, 122, 0.3);
}
.btn-cherry-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    font-weight: 500;
    padding: 8px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-cherry-outline:hover {
    background: var(--primary);
    color: #ffffff;
}
.btn-cherry-sm {
    padding: 6px 16px;
    font-size: 13px;
}
.btn-cherry-lg {
    padding: 12px 32px;
    font-size: 16px;
}

/* ---------- КАРТОЧКИ ---------- */
.card-cherry {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 2px 16px var(--shadow);
    overflow: hidden;
    transition: all var(--transition);
}
.card-cherry:hover {
    box-shadow: 0 8px 40px var(--shadow-hover);
}
.card-cherry-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafaf8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-cherry-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-cherry-body {
    padding: 20px 24px 24px 24px;
}

/* ---------- ЗАГОЛОВКИ ---------- */
.title-cherry {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    padding-left: 16px;
    border-left: 4px solid var(--primary-light);
}
.subtitle-cherry {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    padding-left: 12px;
    border-left: 3px solid var(--primary-light);
}

/* ---------- ВКЛАДКИ ---------- */
.tab-cherry {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #5a6a6a;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}
.tab-cherry:hover {
    color: #2d3a3a;
    background: rgba(74, 106, 122, 0.04);
}
.tab-cherry-active {
    color: #4a6a7a !important;
    border-bottom-color: #4a6a7a !important;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ---------- ТАБЛИЦЫ (СТРОКИ КАК В СПИСКАХ) ---------- */
.table-wrapper {
    background: transparent;
    padding: 8px 0;
}
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
}
.table-scroll::-webkit-scrollbar {
    height: 6px;
}
.table-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.table-scroll::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
.table-scroll::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.table-cherry {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    background: transparent;
}

.table-cherry thead th {
    padding: 12px 16px 16px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #5a6a6a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    border-bottom: none;
    white-space: nowrap;
}
.table-cherry tbody td {
    padding: 14px 16px;
    background: #ffffff;
    border: none;
    font-size: 14px;
    color: #2d3a3a;
    vertical-align: middle;
}
.table-cherry tbody td:first-child {
    border-radius: 10px 0 0 10px;
}
.table-cherry tbody td:last-child {
    border-radius: 0 10px 10px 0;
}
.table-cherry tbody tr {
    transition: all 0.2s ease;
    cursor: default;
}
.table-cherry tbody tr:hover td {
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(45, 45, 45, 0.08);
    transform: scale(1.003);
}
.table-cherry tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 0 #4a6a7a, 0 4px 16px rgba(45, 45, 45, 0.08);
}

/* ---------- БЭДЖИ ---------- */
.badge-cherry {
    display: inline-block;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 9999px;
}
.badge-cherry-success {
    background: rgba(90, 138, 106, 0.15);
    color: #5a8a6a;
}
.badge-cherry-danger {
    background: rgba(138, 90, 90, 0.15);
    color: #8a5a5a;
}
.badge-cherry-primary {
    background: rgba(74, 106, 122, 0.12);
    color: #4a6a7a;
}
.badge-cherry-warning {
    background: rgba(138, 138, 74, 0.15);
    color: #8a8a4a;
}

/* ---------- ПОИСК ---------- */
.search-cherry {
    padding: 8px 14px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%235a6a6a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 10px center;
    background-size: 18px;
    width: 250px;
    transition: all 0.2s ease;
    outline: none;
}
.search-cherry:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 106, 122, 0.1);
    width: 320px;
}
.search-cherry::placeholder {
    color: #b0b8b8;
}
.search-clear {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}
.search-clear.show {
    display: inline-block;
}
.search-clear:hover {
    color: var(--danger);
}
.relative {
    position: relative;
}
.hidden-row {
    display: none !important;
}
.result-count {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.result-count strong {
    color: var(--text);
}

/* ---------- ПОЛЯ ВВОДА ---------- */
.input-cherry {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    transition: all var(--transition);
    outline: none;
    background: #ffffff;
}
.input-cherry:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(74, 106, 122, 0.08);
}
.input-cherry-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* ---------- ДЕЙСТВИЯ ---------- */
.action-cell {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}
.action-cell a,
.action-cell button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    border: none;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
}
.action-cell a:hover {
    background: rgba(74, 106, 122, 0.1);
    color: var(--primary);
}
.action-cell button:hover {
    background: rgba(138, 90, 90, 0.1);
    color: var(--danger);
}
.action-cell svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   МОДАЛЬНЫЕ ОКНА
   ============================================================ */

/* Затемнение (overlay) — общее для всех модалок */
#requisitesModal,
#informationModal,
#createContactModal,
#createObjectModal,
#createCompanyModal,
#createContractModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#requisitesModal.show,
#informationModal.show,
#createContactModal.show,
#createObjectModal.show,
#createCompanyModal.show,
#createContractModal.show {
    display: flex;
    opacity: 1;
    visibility: visible;
}

body.modal-open {
    overflow: hidden;
}

/* Контейнер — общий для всех модалок */
#requisitesModal .modal-container,
#informationModal .modal-container,
#createContactModal .modal-container,
#createObjectModal .modal-container,
#createCompanyModal .modal-container,
#createContractModal .modal-container {
    background: #ffffff;
    border-radius: 12px;
    max-width: 768px;
    width: 95%;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
    border: 1px solid #e8e8e4;
    position: relative;
    z-index: 100000;
    margin: 20px;
}

.modal-container::-webkit-scrollbar {
    width: 6px;
}
.modal-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.modal-container::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}
.modal-container::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Специфичные размеры для разных модалок */
#informationModal .modal-container {
    max-width: 700px;
}

#requisitesModal .modal-container {
    max-width: 800px;
}

#createContactModal .modal-container,
#createObjectModal .modal-container,
#createCompanyModal .modal-container,
#createContractModal .modal-container {
    max-width: 700px;
}

/* ---------- ОБЩИЙ HEADER МОДАЛОК ---------- */
.modal-header {
    background: #fafaf8;
    border-bottom: 2px solid #e8e8e4;
    border-radius: 12px 12px 0 0;
    padding: 20px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}
.modal-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #2d3a3a;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.modal-header-subtitle {
    font-size: 14px;
    color: #5a6a6a;
    margin-top: 2px;
}
.modal-close-btn {
    background: transparent;
    border: none;
    color: #5a6a6a;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close-btn:hover {
    background: #f1f0ee;
    color: #2d3a3a;
}
.modal-close-btn svg {
    width: 24px;
    height: 24px;
}

.modal-body {
    padding: 24px 28px 20px;
}
.modal-footer {
    background: #fafaf8;
    border-top: 2px solid #e8e8e4;
    border-radius: 0 0 12px 12px;
    padding: 16px 28px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-shrink: 0;
}

/* ---------- ВНУТРЕННИЕ ЭЛЕМЕНТЫ МОДАЛОК ---------- */

/* Блоки внутри модалки */
#requisitesModal .form-block,
#informationModal .form-block {
    margin-bottom: 28px;
}

#requisitesModal .form-block:last-of-type,
#informationModal .form-block:last-of-type {
    margin-bottom: 0;
}

/* Заголовок блока */
#requisitesModal .form-block-header,
#informationModal .form-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

#requisitesModal .form-block-header .block-line,
#informationModal .form-block-header .block-line {
    width: 4px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
}

#requisitesModal .form-block-header .block-line.blue,
#informationModal .form-block-header .block-line.blue {
    background: #4a6a7a;
}

#requisitesModal .form-block-header .block-line.green,
#informationModal .form-block-header .block-line.green {
    background: #5a8a6a;
}

#requisitesModal .form-block-header .block-line.purple,
#informationModal .form-block-header .block-line.purple {
    background: #8a6a9a;
}

#requisitesModal .form-block-header h3,
#informationModal .form-block-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2d3a3a;
    margin: 0;
}

#requisitesModal .form-block-header .block-hint,
#informationModal .form-block-header .block-hint {
    font-size: 12px;
    color: #8a9a9a;
    margin-left: 4px;
}

/* Сетка полей */
#requisitesModal .fields-grid,
#informationModal .fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
    background: #fafaf8;
    border-radius: 10px;
    padding: 18px 20px;
    border: 1px solid #e8e8e4;
}

#requisitesModal .fields-grid.full-width,
#informationModal .fields-grid.full-width {
    grid-template-columns: 1fr;
}

/* Группа поля */
#requisitesModal .field-group-modal,
#informationModal .field-group-modal {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#requisitesModal .field-group-modal label,
#informationModal .field-group-modal label {
    font-size: 11px;
    font-weight: 600;
    color: #5a6a6a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#requisitesModal .field-group-modal input,
#informationModal .field-group-modal input,
#requisitesModal .field-group-modal select,
#informationModal .field-group-modal select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e8e8e4;
    border-radius: 8px;
    font-size: 14px;
    color: #2d3a3a;
    transition: all 0.2s ease;
    background: #ffffff;
    outline: none;
}

#requisitesModal .field-group-modal input:focus,
#informationModal .field-group-modal input:focus,
#requisitesModal .field-group-modal select:focus,
#informationModal .field-group-modal select:focus {
    border-color: #4a6a7a;
    box-shadow: 0 0 0 3px rgba(74, 106, 122, 0.12);
}

#requisitesModal .field-group-modal input::placeholder,
#informationModal .field-group-modal input::placeholder {
    color: #b0b8b8;
}

/* Инфо-подсказка */
#requisitesModal .info-hint,
#informationModal .info-hint {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: #f4f6f5;
    border-radius: 10px;
    border: 1px solid #e0e8e4;
    margin-top: 20px;
}

#requisitesModal .info-hint svg,
#informationModal .info-hint svg {
    width: 20px;
    height: 20px;
    color: #4a6a7a;
    flex-shrink: 0;
    margin-top: 1px;
}

#requisitesModal .info-hint p,
#informationModal .info-hint p {
    font-size: 13px;
    color: #5a6a6a;
    margin: 0;
    line-height: 1.5;
}

/* Кнопки в модалках */
#requisitesModal .btn-cherry-outline-modal,
#informationModal .btn-cherry-outline-modal {
    background: transparent;
    color: #4a6a7a;
    border: 1.5px solid #4a6a7a;
    font-weight: 500;
    padding: 6px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#requisitesModal .btn-cherry-outline-modal:hover,
#informationModal .btn-cherry-outline-modal:hover {
    background: #4a6a7a;
    color: #ffffff;
}

#requisitesModal .btn-cherry-modal,
#informationModal .btn-cherry-modal {
    background: linear-gradient(135deg, #4a6a7a 0%, #6a8a9a 100%);
    color: #ffffff;
    font-weight: 500;
    padding: 6px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(74, 106, 122, 0.2);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#requisitesModal .btn-cherry-modal:hover,
#informationModal .btn-cherry-modal:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 106, 122, 0.3);
}

/* Кнопки в модалках создания */
#createContactModal .btn-cherry-outline,
#createObjectModal .btn-cherry-outline,
#createCompanyModal .btn-cherry-outline,
#createContractModal .btn-cherry-outline {
    background: transparent;
    color: #4a6a7a;
    border: 1.5px solid #4a6a7a;
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#createContactModal .btn-cherry-outline:hover,
#createObjectModal .btn-cherry-outline:hover,
#createCompanyModal .btn-cherry-outline:hover,
#createContractModal .btn-cherry-outline:hover {
    background: #4a6a7a;
    color: #ffffff;
}

#createContactModal .btn-cherry,
#createObjectModal .btn-cherry,
#createCompanyModal .btn-cherry,
#createContractModal .btn-cherry {
    background: linear-gradient(135deg, #4a6a7a 0%, #6a8a9a 100%);
    color: #ffffff;
    font-weight: 500;
    padding: 8px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(74, 106, 122, 0.2);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#createContactModal .btn-cherry:hover,
#createObjectModal .btn-cherry:hover,
#createCompanyModal .btn-cherry:hover,
#createContractModal .btn-cherry:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 106, 122, 0.3);
}

/* ============================================================
   КАЛЕНДАРЬ
============================================================ */
.calendar-grid {
    display: grid;
    gap: 2px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
}

.calendar-grid.month {
    grid-template-columns: repeat(7, 1fr);
}

.calendar-grid.week {
    grid-template-columns: repeat(7, 1fr);
}

.calendar-grid.halfyear {
    grid-template-columns: repeat(7, 1fr);
}

.calendar-header {
    display: contents;
}

.calendar-header .day-name {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    padding: 4px 0;
    background: #f8fafc;
    border-radius: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 2px;
    font-size: 12px;
    position: relative;
    min-height: 32px;
}

.calendar-day:hover {
    background: #e2e8f0;
}

.calendar-day.other-month {
    color: #94a3b8;
    background: #f8fafc;
}

.calendar-day.other-month:hover {
    background: #f1f5f9;
}

.calendar-day.selected {
    background: #4a6a7a;
    color: white;
}

.calendar-day.selected:hover {
    background: #3a5a6a;
}

.calendar-day.today {
    border: 2px solid #4a6a7a;
}

.calendar-day .day-number {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.calendar-day .day-events {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    margin-top: 1px;
    width: 100%;
    justify-content: center;
}

.calendar-day .day-event-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    display: inline-block;
}

.calendar-day .day-event-dot.blue { background: #3b82f6; }
.calendar-day .day-event-dot.yellow { background: #f59e0b; }
.calendar-day .day-event-dot.green { background: #10b981; }
.calendar-day .day-event-dot.red { background: #ef4444; }

/* Для 6 месяцев */
.calendar-grid.halfyear .calendar-day {
    font-size: 10px;
    min-height: 24px;
}

.calendar-grid.halfyear .day-number {
    font-size: 10px;
}

.calendar-grid.halfyear .calendar-day .day-event-dot {
    width: 3px;
    height: 3px;
}

/* Навигация */
.calendar-nav-btn {
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
    background: #f1f5f9;
}

.calendar-view-btn {
    padding: 4px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.calendar-view-btn:hover {
    background: #f1f5f9;
}

.calendar-view-btn.active {
    background: #4a6a7a;
    color: white;
    border-color: #4a6a7a;
}

.calendar-view-btn.active:hover {
    background: #3a5a6a;
}

/* ============================================================
   АДАПТИВ ДЛЯ МОДАЛОК
   ============================================================ */

@media (max-width: 640px) {
    #requisitesModal .fields-grid,
    #informationModal .fields-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px 16px;
    }
    
    #requisitesModal .modal-header,
    #informationModal .modal-header {
        padding: 16px 20px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    #requisitesModal .modal-header-title,
    #informationModal .modal-header-title {
        font-size: 17px;
    }
    
    #requisitesModal .modal-body,
    #informationModal .modal-body {
        padding: 16px 20px;
    }
    
    #requisitesModal .modal-footer,
    #informationModal .modal-footer {
        padding: 14px 20px;
        flex-wrap: wrap;
    }
    
    #requisitesModal .modal-footer .btn-cherry-modal,
    #informationModal .modal-footer .btn-cherry-modal,
    #requisitesModal .modal-footer .btn-cherry-outline-modal,
    #informationModal .modal-footer .btn-cherry-outline-modal {
        width: 100%;
        justify-content: center;
    }
    
    #requisitesModal .info-hint,
    #informationModal .info-hint {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   БЛОКИ ПОЛЬЗОВАТЕЛЬСКИХ ПОЛЕЙ
   ============================================================ */

.block-custom {
    border-left: 3px solid #4a6a7a;
    padding-left: 12px;
}

.field-group {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.field-group:last-child {
    border-bottom: none;
}
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 2px;
}
.field-value {
    font-size: 15px;
    color: #111827;
    padding: 4px 0;
}

/* ---------- ПАНЕЛЬ РЕДАКТИРОВАНИЯ ---------- */
.edit-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 2px solid #4a6a7a;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.10);
    padding: 12px 24px;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.edit-panel.active {
    display: flex;
}
.edit-panel .panel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #5a6a6a;
}
.edit-panel .panel-info .count {
    font-weight: 600;
    color: #2d3a3a;
}
.edit-panel .panel-actions {
    display: flex;
    gap: 12px;
}
.edit-panel .btn-cancel {
    background: transparent;
    color: #5a6a6a;
    border: 1.5px solid #d1d5db;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.edit-panel .btn-cancel:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.edit-panel .btn-save {
    background: linear-gradient(135deg, #4a6a7a 0%, #6a8a9a 100%);
    color: #ffffff;
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(74, 106, 122, 0.25);
}
.edit-panel .btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(74, 106, 122, 0.35);
}
.edit-panel .btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
.edit-panel .btn-save .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}
.edit-panel .btn-save.loading .spinner {
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- РЕДАКТИРУЕМЫЕ ПОЛЯ ---------- */
.editable-field {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-block;
    min-width: 60px;
    border: 1px solid transparent;
    min-height: 32px;
    width: 100%;
}
.editable-field:hover {
    background: #f1f0ee;
    border-color: #e8e8e4;
}
.editable-field.editing {
    border-color: #4a6a7a;
    background: white;
    padding: 2px 4px;
    cursor: default;
    width: 100%;
}
.editable-field .editing-input {
    border: none;
    background: transparent;
    font-size: 15px;
    color: #2d3a3a;
    padding: 2px 4px;
    outline: none;
    width: 100%;
    font-family: inherit;
}
.editable-field .editing-input:focus {
    outline: none;
}
.editable-field .editing-textarea {
    border: none;
    background: transparent;
    font-size: 15px;
    color: #2d3a3a;
    padding: 2px 4px;
    outline: none;
    width: 100%;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}
.editable-field .editing-textarea:focus {
    outline: none;
}

/* ---------- КАСТОМНЫЕ ПОЛЯ ---------- */
.custom-field-select {
    padding: 4px 8px;
    border: 1px solid #e8e8e4;
    border-radius: 6px;
    font-size: 14px;
    color: #2d3a3a;
    background: white;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}
.custom-field-select:focus {
    border-color: #4a6a7a;
    box-shadow: 0 0 0 3px rgba(74, 106, 122, 0.12);
}
.toggle-checkbox {
    background: none;
    border: none;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.toggle-checkbox:hover {
    background: #f1f0ee;
}

/* ---------- ФАЙЛЫ ---------- */
.file-upload-btn {
    background: #f1f0ee;
    border: 1px solid #e8e8e4;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.file-upload-btn:hover {
    background: #e8e8e4;
}
.file-name {
    font-size: 13px;
    color: #4a6a7a;
    margin-left: 8px;
}
.file-menu {
    display: none;
}
.file-menu:not(.hidden) {
    display: block;
}
.file-menu.hidden {
    display: none;
}

/* ---------- TOAST ---------- */
.toast-notification {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: rgba(45, 58, 58, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    max-width: 400px;
    border-left: 4px solid #6a8a9a;
}
.toast-notification.success {
    border-left-color: #5a8a6a;
}
.toast-notification.error {
    border-left-color: #8a5a5a;
}
@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- ВЫПАДАЮЩИЙ ПОИСК ---------- */
.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 60vw;
    min-width: 380px;
    max-width: 700px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e8e8e4;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scaleX(0.95) scaleY(0.95);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 100;
}
.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: scaleX(1) scaleY(1);
}
.search-dropdown .dropdown-header {
    padding: 12px 16px;
    background: #fafaf8;
    border-bottom: 1px solid #e8e8e4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #5a6a6a;
}
.search-dropdown .dropdown-header .count {
    font-weight: 600;
    color: #2d3a3a;
}
.search-dropdown .dropdown-header .close-btn {
    background: none;
    border: none;
    color: #5a6a6a;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s ease;
}
.search-dropdown .dropdown-header .close-btn:hover {
    color: #2d3a3a;
}
.search-dropdown .dropdown-body {
    max-height: 300px;
    min-height: 80px;
    overflow-y: auto;
    padding: 4px 0;
}
.search-dropdown .dropdown-body::-webkit-scrollbar {
    width: 4px;
}
.search-dropdown .dropdown-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}
.search-dropdown .dropdown-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}
.search-dropdown .dropdown-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.search-dropdown .dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid #e8e8e4;
    background: #fafaf8;
    border-radius: 0 0 10px 10px;
}
.search-dropdown .dropdown-footer .btn-create {
    display: block;
    width: 100%;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4a6a7a 0%, #6a8a9a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(74, 106, 122, 0.2);
}
.search-dropdown .dropdown-footer .btn-create:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 106, 122, 0.3);
}

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f1f0ee;
    transition: background 0.1s ease;
    cursor: default;
}
.search-result-item:last-child {
    border-bottom: none;
}
.search-result-item:hover {
    background: #f8f7f5;
}
.search-result-item .result-info {
    flex: 1;
    min-width: 0;
}
.search-result-item .result-name {
    font-weight: 500;
    color: #2d3a3a;
    font-size: 14px;
}
.search-result-item .result-details {
    font-size: 13px;
    color: #5a6a6a;
    margin-top: 2px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.search-result-item .result-details span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.search-result-item .result-company {
    font-size: 12px;
    color: #8a9a9a;
    margin-top: 2px;
}
.search-result-item .result-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}
.search-result-item .result-actions .btn-attach {
    background: #4a6a7a;
    color: white;
    border: none;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}
.search-result-item .result-actions .btn-attach:hover {
    background: #3a5a6a;
}
.search-result-item .result-actions .btn-go {
    background: #e8e8e4;
    color: #2d3a3a;
    border: none;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.search-result-item .result-actions .btn-go:hover {
    background: #d5d5d0;
}

.search-empty {
    padding: 20px 16px;
    text-align: center;
    color: #8a9a9a;
    font-size: 14px;
}

/* ---------- RESIZE КОЛОНОК ---------- */
th[data-field-id] {
    position: relative;
}

.resize-handle {
    position: absolute;
    right: -3px;
    top: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    border-left: 2px solid transparent;
    transition: border-color 0.2s;
    z-index: 5;
}

.resize-handle:hover {
    border-left-color: #4a6a7a;
}

.resize-handle:active {
    border-left-color: #4a6a7a;
    background: rgba(74, 106, 122, 0.05);
}


/* ============================================================
   СООТНОШЕНИЕ КОЛОНОК 40/60
   ============================================================ */
.info-column {
    flex: 0 0 55%;
    max-width: 55%;
}
.action-column {
    flex: 0 0 45%;
    max-width: 45%;
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   АДАПТИВ
   ============================================================ */
@media (max-width: 768px) {
    .table-cherry {
        min-width: 600px;
    }
    .title-cherry {
        font-size: 20px;
        padding-left: 12px;
    }
    .search-cherry {
        width: 100%;
    }
    .search-cherry:focus {
        width: 100%;
    }
    .info-column,
    .action-column {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .title-cherry {
        font-size: 18px;
    }
    .btn-cherry {
        padding: 6px 14px;
        font-size: 13px;
    }
    .table-cherry tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
    .table-cherry thead th {
        padding: 8px 12px;
        font-size: 10px;
    }
    .action-cell a,
    .action-cell button {
        padding: 4px;
    }
    .action-cell svg {
        width: 16px;
        height: 16px;
    }

    .edit-panel {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
    }
    .edit-panel .panel-actions {
        justify-content: stretch;
    }
    .edit-panel .panel-actions button {
        flex: 1;
        justify-content: center;
    }

    .search-dropdown {
        width: 90vw;
        min-width: unset;
        max-width: 90vw;
        right: -10px;
    }
}