/* Высота карточки — по панели вкладки, а не по формуле от 100vh */
.doc-card {
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.doc-card > .ant-card-head {
    flex: none;
}

.doc-card .ant-card-body {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    /* max-height: calc(100vh - 170px); */
    overflow-y: auto;
}

body:has(.doc-card) .ant-pro-global-footer {
    display: none;
}

.doc-card .ant-card-body .ant-spin-nested-loading,
.doc-card .ant-card-body .ant-spin-nested-loading > div,
.doc-card .ant-card-body .ant-spin-container,
.doc-card .ant-card-body form.ant-form,
.doc-card .ant-card-body .doc-card-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

.doc-card-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.doc-card-toolbar .doc-card-toolbar-spacer {
    margin-left: auto;
}

.doc-card-status {
    margin-bottom: 10px;
}

.doc-card-status .ant-alert {
    padding: 6px 12px;
}

.doc-card-status .ant-alert-message {
    font-size: 13px;
}

.doc-card-status .ant-alert-description {
    font-size: 12px;
}

.doc-card-total {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
    padding-top: 4px;
}

.doc-card-total-dec {
    color: #cf1322;
    font-size: 12px;
}

.doc-card-total-vat {
    color: #8c8c8c;
    font-size: 12px;
}

.doc-card-form .ant-form-item {
    margin-bottom: 8px;
}

.doc-card-form .ant-form-item-label {
    padding-bottom: 0;
    line-height: 1.2;
}

.doc-card-form .ant-form-item-label > label {
    font-size: 12px;
    color: #8c8c8c;
    height: auto;
}

.doc-card-form .ant-form-item-label > label::after {
    content: none;
}

.doc-card-form .ant-input,
.doc-card-form .ant-select-selector,
.doc-card-form .ant-picker {
    height: 30px;
}

.doc-card-form .ant-form-item-explain {
    font-size: 12px;
    line-height: 1.4;
}

.doc-card-form .ant-select-single .ant-select-selector .ant-select-selection-item,
.doc-card-form .ant-select-single .ant-select-selector .ant-select-selection-placeholder {
    line-height: 28px;
}

/* Изменённые и ещё не сохранённые поля */
.doc-card-form .doc-field-changed .ant-form-item-label > label {
    color: #d46b08;
    font-weight: 600;
}

.doc-card-form .doc-field-changed .ant-input,
.doc-card-form .doc-field-changed .ant-select:not(.ant-select-disabled) .ant-select-selector,
.doc-card-form .doc-field-changed .ant-picker {
    border-color: #ffa940;
    background-color: #fff7e6;
}

.doc-card-side-block.doc-field-changed {
    border-color: #ffa940;
}

.doc-card-side-block.doc-field-changed .doc-card-side-header {
    background: #fff7e6;
    color: #d46b08;
}

.doc-card-unsaved {
    color: #d46b08;
    font-size: 12px;
}

.doc-card-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.doc-card-side-block {
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.doc-card-side-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    font-weight: 600;
    color: #262626;
}

.doc-card-side-header .doc-card-side-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.doc-card-files .ant-table-wrapper,
.doc-card-tags .ant-table-wrapper {
    max-height: 100%;
}

.doc-card-files .ant-table-body,
.doc-card-tags .ant-table-body {
    overflow-y: auto !important;
}

.doc-card-files .ant-table-tbody > tr > td,
.doc-card-tags .ant-table-tbody > tr > td,
.doc-card-files .ant-table-thead > tr > th,
.doc-card-tags .ant-table-thead > tr > th {
    padding: 5px 8px;
    font-size: 12px;
}

.doc-card-files {
    flex: 1 1 auto;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.doc-card-files .ant-table-wrapper,
.doc-card-files .ant-spin-nested-loading,
.doc-card-files .ant-spin-container,
.doc-card-files .ant-table,
.doc-card-files .ant-table-container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.doc-card-files .ant-table-header,
.doc-card-files .ant-table-title,
.doc-card-files .ant-table-footer {
    flex: 0 0 auto;
}

.doc-card-files .ant-table-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
}

.doc-card-tags .ant-table-body {
    max-height: 150px;
}

.doc-card .ant-card-body:has(.doc-card-files--all) {
    display: block;
}

.doc-card-files.doc-card-files--all {
    flex: 0 0 auto;
}

.doc-text-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

@media (max-height: 800px) {
    .doc-card-tags .ant-table-body {
        max-height: 110px;
    }
}

.disk-dropzone {
    position: relative;
    display: block;
    padding: 8px 12px;
}

.disk-dropzone.disk-dropzone-over {
    border-color: #1890ff;
    background: #f0f7ff;
}

.disk-dropzone .ant-upload-drag-icon {
    margin-bottom: 0;
    line-height: 1;
}

.disk-dropzone .ant-upload-text {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.5;
}

.disk-dropzone .ant-upload-hint {
    margin-bottom: 0;
    font-size: 12px;
    line-height: 1.5;
}

.disk-options-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-bottom: 10px;
    padding: 5px 10px;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    background: #fafafa;
}

.disk-options-bar .ant-checkbox-wrapper {
    margin-left: 0;
    font-size: 13px;
}

.disk-card .doc-card-tags .ant-table-content {
    max-height: 120px;
    overflow-y: auto;
}

.disk-card .doc-card-tags .ant-pagination {
    margin: 6px 10px;
}

.disk-error {
    padding: 6px 10px;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    background: #fff2f0;
    color: #ff4d4f;
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

.mcd-info-panel .ant-alert {
    padding: 1px 10px;
    font-size: 12px;
    line-height: 20px;
}

.mcd-info-panel .ant-alert-icon {
    margin-right: 6px;
    font-size: 13px;
}

.doc-status-tag {
    display: inline-block;
    max-width: 100%;
    padding: 1px 8px;
    font-size: 12px;
    line-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.doc-preview-viewer {
    width: 100%;
    height: 70vh;
}

.doc-preview-xml {
    overflow: auto;
    padding: 16px;
    background-color: #f8f9fa;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
}

.doc-preview-frame {
    border: none;
    background: #fff;
}

.doc-preview-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 4px;
    box-sizing: border-box;
    overflow: auto;
}

.doc-preview-image img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.doc-preview-modal .ant-modal-max .ant-modal-body div:has(.doc-preview-viewer, .doc-preview-image),
.doc-preview-modal .ant-modal-max .doc-preview-viewer,
.doc-preview-modal .ant-modal-max .doc-preview-image {
    height: 100%;
}

.doc-preview-modal .ant-modal-max .doc-preview-image img {
    max-height: 100%;
}
