.receipt-folder-page {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  animation: fadeUp 220ms var(--ease) both;
  overflow: hidden;
}

.receipt-folder-list,
.receipt-folder-detail {
  min-height: 0;
  overflow: hidden;
}

.receipt-folder-list {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 16px 18px;
}

.receipt-folder-list th:first-child,
.receipt-folder-list td:first-child {
  text-align: left;
}

.receipt-folder-list td:first-child .doc-id {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-file { width: 22%; }
.col-kind { width: 13%; }
.col-scene { width: 13%; }
.col-money { width: 10%; }
.col-date { width: 12%; }
.col-score { width: 10%; }
.col-status { width: 10%; }
.col-updated { width: 14%; }

.receipt-field-list-head {
  display: flex;
  align-items: center;
}

.receipt-ocr-field input {
  width: 100%;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.receipt-ocr-field input {
  height: 36px;
  padding: 0 10px;
}

.receipt-ocr-field input:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 3px rgba(58, 124, 165, 0.14);
  outline: none;
}

.apply-btn,
.ghost-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.ghost-btn {
  padding: 0 13px;
  border: 1px solid #d7e0ea;
  background: #fff;
  color: #334155;
}

.apply-btn {
  padding: 0 14px;
  border: 1px solid var(--theme-primary);
  background: var(--theme-primary);
  color: #fff;
}

.apply-btn:disabled,
.ghost-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.receipt-folder-detail {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 0;
}

.receipt-folder-detail :deep(.detail-scroll) {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 0;
  overflow: auto;
}

.receipt-folder-detail :deep(.detail-scroll) > * {
  min-width: 0;
  flex: 0 0 auto;
}

.receipt-folder-detail :deep(.detail-actions) {
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
}

.receipt-folder-detail :deep(.detail-action-group) {
  min-width: 0;
  flex-wrap: wrap;
}

.receipt-folder-detail :deep(.detail-grid) {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr);
  gap: 16px;
  align-items: start;
  overflow: visible;
}

.receipt-folder-detail :deep(.detail-bottom) {
  min-width: 0;
  display: block;
}

.receipt-folder-detail :deep(.detail-main),
.receipt-folder-detail :deep(.detail-side) {
  min-width: 0;
  display: block;
}

.receipt-folder-detail :deep(.enterprise-detail-card .card-head) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.receipt-folder-detail :deep(.enterprise-detail-card .card-head h3) {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
  font-weight: 850;
}

.receipt-folder-detail :deep(.enterprise-detail-card .card-head p) {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.receipt-preview-panel,
.receipt-ticket-info-panel,
.receipt-association-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dbe4ee;
  border-radius: 4px;
  background: #fff;
  padding: 14px;
}

.receipt-ticket-info-panel {
  display: grid;
  gap: 10px;
}

.receipt-card-actions {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.receipt-ticket-info-panel :deep(.card-head) {
  margin-bottom: 10px;
}

.receipt-ticket-info-panel input {
  height: 32px;
  padding: 0 9px;
}

.receipt-ticket-section {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.receipt-ticket-section + .receipt-ticket-section {
  padding-top: 10px;
  border-top: 1px solid #edf2f7;
}

.receipt-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.receipt-section-head strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 850;
}

.receipt-field-list-head small,
.receipt-section-head small {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.receipt-ocr-field {
  display: grid;
  gap: 6px;
}

.receipt-ocr-field span,
.receipt-static-item span,
.receipt-data-item span {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.receipt-card-count {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.receipt-static-grid,
.receipt-data-list {
  display: grid;
  gap: 10px;
}

.receipt-static-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #edf2f7;
}

.receipt-static-item,
.receipt-data-item {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.receipt-static-item strong,
.receipt-data-item strong {
  min-width: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.receipt-all-field-grid {
  max-height: clamp(360px, 60vh, 640px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding-right: 4px;
  overflow-y: auto;
}

.receipt-all-field-grid.editing {
  max-height: clamp(420px, 64vh, 680px);
}

.receipt-ocr-field {
  padding: 8px 10px;
  border: 1px solid #e5edf5;
  border-radius: 4px;
  background: #f8fafc;
}

.receipt-ocr-field strong {
  min-width: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.receipt-field-empty {
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed #d7e0ea;
  border-radius: 4px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.receipt-preview-panel {
  align-self: start;
  display: grid;
  gap: 12px;
}

.receipt-preview-frame {
  min-width: 0;
  min-height: 0;
  padding: 10px;
  border: 1px solid #e5edf5;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.receipt-preview-box {
  width: 100%;
  height: clamp(380px, 56vh, 640px);
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #f7fbff;
}

.receipt-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 180ms ease;
}

.receipt-preview-box iframe {
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: 0;
  background: #fff;
}

.preview-empty {
  display: grid;
  gap: 8px;
  justify-items: center;
  color: #64748b;
  text-align: center;
}

.preview-empty .mdi {
  color: var(--theme-primary);
  font-size: 34px;
}

.receipt-preview-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
}

.preview-page,
.preview-tool-group {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.preview-page {
  padding: 0 12px;
  border: 1px solid #e1e8f0;
  border-radius: 4px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.preview-tool-group {
  gap: 6px;
}

.preview-tool-group button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #e1e8f0;
  border-radius: 4px;
  background: #fff;
  color: #334155;
}

.preview-tool-group button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.preview-tool-group strong {
  min-width: 48px;
  text-align: center;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.receipt-edit-log-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #edf2f7;
}

.receipt-edit-log-section header,
.receipt-edit-log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.receipt-edit-log-section header strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 850;
}

.receipt-edit-log-section header span,
.receipt-edit-log-meta span {
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.receipt-edit-log-list {
  display: grid;
  max-height: 180px;
  gap: 8px;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  overflow-y: auto;
}

.receipt-edit-log-list li {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid #e5edf5;
  border-radius: 4px;
  background: #f8fafc;
}

.receipt-edit-log-meta strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.receipt-edit-log-list p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: #334155;
  font-size: 12px;
}

.receipt-edit-log-list p span {
  color: #64748b;
  font-weight: 750;
}

.receipt-edit-log-list p em {
  max-width: 160px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-edit-log-list p strong {
  max-width: 180px;
  color: #0f172a;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-edit-log-empty {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed #d7e0ea;
  border-radius: 4px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.receipt-data-list.association {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.associate-step {
  display: grid;
  gap: 12px;
}

.associate-hint {
  margin: 0 0 2px 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.receipt-checkbox-list,
.draft-choice-list {
  max-height: 340px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 1px;
}

.receipt-checkbox-list :deep(.el-checkbox),
.draft-choice {
  display: flex !important;
  min-height: 52px;
  align-items: center;
  margin-right: 0;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  transition: all 150ms ease;
  box-sizing: border-box;
}

.receipt-checkbox-list :deep(.el-checkbox:hover),
.draft-choice:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.receipt-checkbox-list :deep(.el-checkbox.is-checked) {
  border-color: var(--theme-primary);
  background: rgba(58, 124, 165, 0.04);
}

.receipt-checkbox-list :deep(.el-checkbox__label) {
  flex: 1;
  display: grid;
  gap: 2px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.receipt-checkbox-list small,
.draft-choice small {
  color: #64748b;
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.35;
}

.draft-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  cursor: pointer;
}

.draft-choice.active {
  border-color: var(--theme-primary);
  background: rgba(58, 124, 165, 0.04);
}

.draft-choice span {
  display: grid;
  gap: 2px;
}

.draft-choice strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

/* Global styles for the association dialog */
:global(.receipt-associate-dialog.el-dialog) {
  border-radius: 6px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

:global(.receipt-associate-dialog .el-dialog__header) {
  padding: 20px 24px 12px 24px;
  margin-right: 0;
}

:global(.receipt-associate-dialog .el-dialog__headerbtn) {
  top: 20px;
  right: 24px;
}

:global(.receipt-associate-dialog .el-dialog__title) {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

:global(.receipt-associate-dialog .el-dialog__body) {
  padding: 0 24px 20px 24px;
}

:global(.receipt-associate-dialog .el-dialog__footer) {
  padding: 12px 24px 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

:global(.receipt-associate-dialog .el-dialog__footer .apply-btn),
:global(.receipt-associate-dialog .el-dialog__footer .ghost-btn) {
  min-height: 36px;
  height: 36px;
  padding: 0 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: all 150ms ease;
}

:global(.receipt-associate-dialog .el-dialog__footer .ghost-btn) {
  border-color: #cbd5e1;
  color: #334155;
  background: #fff;
}

:global(.receipt-associate-dialog .el-dialog__footer .ghost-btn:hover) {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

:global(.receipt-associate-dialog .el-dialog__footer .apply-btn) {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: #fff;
}

:global(.receipt-associate-dialog .el-dialog__footer .apply-btn:hover:not(:disabled)) {
  background: var(--theme-primary-active);
  border-color: var(--theme-primary-active);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

@media (max-width: 1180px) {
  .receipt-folder-detail :deep(.detail-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .receipt-folder-page {
    height: auto;
    min-height: 100%;
    display: block;
    overflow: visible;
  }

  .receipt-folder-list {
    height: auto;
    min-height: 100%;
    display: block;
    overflow: visible;
    padding: 12px;
  }

  .receipt-status-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .receipt-status-tabs button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .receipt-folder-list .document-actions,
  .receipt-folder-list .filter-set,
  .receipt-folder-list .list-search,
  .receipt-folder-list .filter-btn,
  .receipt-folder-list .create-request-btn,
  .receipt-folder-list .page-size-select {
    width: 100%;
  }

  .receipt-folder-list td:first-child .doc-id {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .receipt-preview-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-preview-tools > *,
  .preview-tool-group {
    width: 100%;
  }

  .preview-tool-group {
    justify-content: center;
  }

  .receipt-static-grid,
  .receipt-all-field-grid,
  .receipt-data-list.association {
    grid-template-columns: 1fr;
  }

  .receipt-preview-box {
    height: clamp(320px, 60vh, 520px);
  }
}
