.history-import { display: grid; gap: 1rem; }
.history-import .panel { min-width: 0; }
.history-import .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.history-review-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.history-import h3, .history-import h4 { margin-bottom: .65rem; }
.history-import .action-row { flex-wrap: wrap; gap: .6rem; }
.history-batch-name { display: grid; gap: .35rem; max-width: 38rem; margin: 1rem 0; }
.history-file-actions label { position: relative; overflow: hidden; cursor: pointer; }
.history-file-actions input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.history-file-actions label:focus-within { outline: 2px solid currentColor; outline-offset: 3px; }
.history-file-list { max-height: 18rem; overflow: auto; margin: .8rem 0; }
.history-file-list ul, .history-batch-list { list-style: none; padding: 0; margin: 0; }
.history-file-list li, .history-batch-list li { display: flex; flex-wrap: wrap; gap: .5rem 1rem; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border, #d8d2c7); }
.history-file-list li > span:first-child { flex: 1 1 14rem; overflow-wrap: anywhere; }
.history-error { color: var(--danger, #b42318); overflow-wrap: anywhere; }
.history-file-list .history-error { flex-basis: 100%; margin: 0; }
.history-items td:first-child { overflow-wrap: anywhere; }
.history-job-choice { margin: 1.2rem 0; padding: 1rem; border: 1px solid var(--border, #d8d2c7); border-radius: .6rem; }
.history-job-choice label { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; min-width: 0; }
.history-invoice { min-width: 0; margin: 1.5rem 0 0; padding: 1rem; border: 1px solid var(--border, #d8d2c7); border-radius: .6rem; }
.history-invoice legend { padding: 0 .4rem; font-weight: 700; }
.history-invoice label { display: grid; gap: .35rem; min-width: 0; }
.history-invoice-work { margin: 1rem 0; }
.history-invoice-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.history-invoice-totals { font-weight: 600; overflow-wrap: anywhere; }
.history-invoice:disabled { opacity: 1; }
#hp-review .form-grid, #hp-comparison { margin-top: 1rem; }
#hp-review caption { padding: .7rem 0; text-align: left; font-weight: 600; }
#hp-review .data-table { min-width: 0; width: 100%; }
#hp-review .data-table th, #hp-review .data-table td { white-space: normal; overflow-wrap: anywhere; }
.history-import select, .history-import input, .history-import textarea { max-width: 100%; }
.history-import .checkbox-row { display: flex; gap: .55rem; margin: 1rem 0; align-items: flex-start; }
.history-readings { margin-top: 1rem; }
.history-readings dl { display: grid; grid-template-columns: minmax(8rem, 1fr) 3fr; gap: .6rem 1rem; }
.history-readings dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .history-import .panel-header { flex-wrap: wrap; gap: .7rem; }
  .history-import .form-grid { grid-template-columns: 1fr; }
  .history-invoice-money { grid-template-columns: 1fr; }
  .history-readings dl { grid-template-columns: 1fr; }
  .history-readings dt { font-weight: 600; }
  .history-items { min-width: 0; width: 100%; }
  .history-items thead { display: none; }
  .history-items tbody { display: block; }
  .history-items tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .history-items td { display: block; width: auto; border: 0; padding: .4rem 0; }
  #hp-review .data-table { table-layout: fixed; }
  #hp-review .data-table th, #hp-review .data-table td { padding: .5rem .4rem; overflow-wrap: normal; }
  #hp-review .data-table th { font-size: .73rem; }
  #hp-review .data-table td { font-size: .83rem; }
  #hp-review .data-table th:first-child { width: 38%; }
}
