.app-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    background: #ffffff;
}
#q-application-table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
}
#q-application-table th, 
#q-application-table td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid #eef2f5;
}
#q-application-table th {
    background-color: #fafafa;
}
#q-application-table tr:hover {
    background-color: #f8fafc;
}

/* Обертка реестра экспертов — горизонтальная прокрутка на узких экранах */
.expert-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

/* Реестр экспертов: видимые рамки ячеек */
#q-application-table.expert-registry th,
#q-application-table.expert-registry td {
    border: 1px solid #ccd0d4;
    vertical-align: top;
}

/* Строки реестра не кликабельны (в отличие от таблицы заявок) */
#q-application-table.expert-registry tbody tr {
    cursor: default;
}
/* Стили для статуса */
.badge {
    padding: 6px 12px;
    font-size: 16px;
    font-weight: 500;
    display: inline-block;
}
.badge-in_work {
    background-color: rgba(167, 167, 167, 0.2);
    color: var(--brand-grey);
}
.badge-accepted {
    background-color: #fef3c7;
    color: #d97706;
}
.badge-completed {
    background-color: #dcfce7;
    color: #15803d;
}

/* Служебное скрытие (в т.ч. для атрибута hidden) */
[hidden] {
    display: none !important;
}

/* Строки таблицы заявок кликабельны */
#q-application-table tbody tr {
    cursor: pointer;
}

/** ДЕТАЛЬНЫЙ ПРОСМОТР ЗАЯВКИ **/
.application-detail {
    background: #ffffff;
    border: 0.5px solid var(--brand-light-grey);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    padding: 32px 40px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.application-detail__top {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}

.app-detail-label {
    display: block;
    font-size: 88%;
    color: var(--brand-dark-grey);
    margin-bottom: 6px;
}

/* Секции */
.app-detail-section {
    padding-top: 28px;
}

.app-detail-section-title {
    margin-bottom: 12px;
}

/* Строка "свойство — значение" с нижним бордером */
.app-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid #eef2f5;
}

.app-detail-row-label {
    color: var(--brand-dark-grey);
    flex-shrink: 0;
}

.app-detail-row-value {
    flex: 1;
    min-width: 0;
}

.app-detail-value {
    display: block;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

/* Поля редактирования раздела "Заявитель" показываем только в режиме правки */
.app-edit-only {
    display: none;
}

.application-detail.is-editing .app-view-only {
    display: none;
}

.application-detail.is-editing .app-edit-only {
    display: block;
}

.application-detail.is-editing .app-detail-row {
    align-items: center;
}

.app-detail-input,
.app-detail-textarea,
.app-detail-select {
    width: 100%;
    max-width: 460px;
    margin-left: auto;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    background-color: #ffffff;
    font-family: inherit;
    font-size: 100%;
    color: #000000;
    display: block;
}

.app-detail-textarea {
    min-height: 110px;
    resize: vertical;
}

.app-detail-input:focus,
.app-detail-textarea:focus,
.app-detail-select:focus {
    outline: 1px solid var(--brand-normal-grey);
    outline-offset: -2px;
    border-color: transparent;
}

/* В разделе «Действия сотрудника» поле статуса выравниваем по левому краю */
.app-detail-field .app-detail-select {
    margin-left: 0;
    max-width: 460px;
}

/* Файлы заявителя */
.app-detail-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.app-detail-empty {
    color: var(--brand-grey);
    padding: 12px 0;
}

.app-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--brand-light-grey);
    border-radius: 4px;
    text-decoration: none;
    color: #000000;
    transition: background-color 0.2s ease;
}

.app-file-item:hover {
    background-color: #e9eef3;
}

.app-file-item img {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.app-file-name {
    font-weight: 500;
    word-break: break-word;
}

.app-file-size {
    margin-left: auto;
    color: var(--brand-grey);
    font-size: 88%;
    flex-shrink: 0;
}

/** ДЕЙСТВИЯ СОТРУДНИКА (отделены линией) **/
.employee-actions {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 2px solid var(--brand-light-grey);
    transition: background-color 0.3s ease;
}

.employee-actions.is-highlighted {
    background-color: #f0f7ea;
}

.app-detail-field {
    margin-bottom: 20px;
}

.app-detail-field:last-child {
    margin-bottom: 0;
}

.app-detail-file-drop {
    display: block;
    border: 2px dashed #c9c9c9;
    border-radius: 6px;
    padding: 24px;
    text-align: center;
    color: #757575;
    cursor: pointer;
    background-color: #fafafa;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.app-detail-file-drop:hover {
    border-color: var(--brand-green);
    color: var(--brand-black);
}

.app-detail-file-drop input[type="file"] {
    display: none;
}

.app-detail-file-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-detail-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background-color: var(--brand-light-grey);
    border-radius: 4px;
    font-size: 88%;
}

/* Нижние кнопки */
.app-detail-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #eef2f5;
}

.app-detail-footer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-left: auto;
}

.app-save-status {
    color: var(--brand-green);
    font-size: 88%;
}

/** Строка редактирования сведений о заявителе */
.app-edit-only {
    display: none !important;
}
.is-editing .app-view-only {
    display: none !important;
}
.is-editing .app-edit-only {
    display: block !important;
}

/** Раскрашивание менб слева */
body:has(#applicationsList:not([hidden])) #menu-applications,
body:has(#applicationDetail:not([hidden])) #menu-applications {
    background-color: #eef2f5;
}
body:has(#profileList:not([hidden])) #menu-profile {
    background-color: #eef2f5;
}

/** Адаптив **/
@media (max-width: 600px) {
    .application-detail {
        padding: 20px;
    }

    .app-detail-row {
        flex-direction: column;
        gap: 8px;
    }

    .app-detail-value {
        text-align: left;
    }

    .app-detail-input,
    .app-detail-textarea,
    .app-detail-select {
        max-width: none;
        margin-left: 0;
    }

    .app-detail-footer-buttons {
        margin-left: 0;
        width: 100%;
    }

    .app-detail-footer-buttons .btn {
        width: 100%;
    }
}
