.request-empty-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.05rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.empty-state-copy,
.request-empty-card p {
  max-width: 42rem;
  color: var(--muted);
  line-height: 1.45;
}

.filter-row-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.table-panel {
  overflow: visible;
}

.table-scroll {
  position: relative;
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(13, 170, 145, 0.08)) right / 2rem 100% no-repeat,
    var(--white);
}

.table-scroll-sticky {
  --workspace-sticky-header-height: 2.48rem;
  --workspace-sticky-filter-height: 2.45rem;
  --workspace-sticky-row-overlap: 1px;
  overflow: visible;
}

.table-scroll:focus {
  outline: 2px solid rgba(13, 170, 145, 0.38);
  outline-offset: 3px;
}

.bulk-action-form button,
td button {
  min-height: 2rem;
  padding: 0.34rem 0.62rem;
  border-color: rgba(13, 170, 145, 0.24);
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  font-size: 0.82rem;
}

.bulk-action-form button[aria-label="Delete selected"] {
  min-width: 2rem;
  padding-inline: 0.55rem;
  font-size: 0.95rem;
  line-height: 1;
}

.row-selection-header {
  position: relative;
  width: 1%;
  min-width: 2.1rem;
  overflow: visible;
  text-align: center;
  z-index: 8;
}

.row-selection-stack {
  display: inline-grid;
  justify-items: center;
  position: relative;
  min-width: 1.45rem;
  min-height: 1rem;
  overflow: visible;
}

.bulk-delete-header-button {
  position: absolute;
  top: calc(100% + 0.85rem);
  left: 50%;
  z-index: 9;
  transform: translateX(-50%);
  --icon-action-size: 1.45rem;
  --icon-action-font-size: 0.9rem;
  border: 1px solid rgba(185, 28, 28, 0.34);
  background: #fff1f2;
  color: #991b1b;
  box-shadow: 0 4px 12px rgba(127, 29, 29, 0.16);
}

.bulk-delete-header-button:not(:disabled):hover,
.bulk-delete-header-button:not(:disabled):focus-visible {
  border-color: rgba(185, 28, 28, 0.62);
  background: #ffe4e6;
}

.bulk-delete-header-button[hidden] {
  display: none;
}

.bulk-delete-header-button::before {
  content: "🗑";
}

.cell-undo-button {
  min-height: 2rem;
  padding: 0.34rem 0.72rem;
  border-color: rgba(13, 170, 145, 0.34);
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
}

.save-state {
  position: absolute;
  right: 0.28rem;
  bottom: 0.22rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  min-height: 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.save-state.save-success {
  background: rgba(229, 255, 248, 0.96);
  color: var(--teal-dark);
}

.save-state.save-error {
  min-width: auto;
  padding: 0.2rem 0.34rem;
  background: rgba(255, 241, 242, 0.96);
  color: var(--danger);
}

.delete-confirmation-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.36);
}

.delete-confirmation {
  width: min(28rem, 100%);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 22px;
  padding: 1.1rem;
  background: var(--white);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.delete-confirmation h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.delete-confirmation p {
  margin: 0;
  color: var(--muted);
}

.delete-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

.delete-confirmation .danger {
  border-color: rgba(220, 38, 38, 0.34);
  background: rgba(254, 242, 242, 0.96);
  color: #991b1b;
}

td form {
  display: inline;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.9rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(245, 247, 250, 0.88));
}

.table-controls-footer {
  justify-content: flex-end;
  margin: 0.9rem 0 0;
  align-items: center;
}

.table-controls-footer .filter-row-count {
  margin-right: auto;
  white-space: nowrap;
}

.table-page-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  padding: 0.48rem 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.table-page-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-page-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  min-width: 1.6rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.table-control {
  width: min(100%, 220px);
}

.table-control-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.table-control-page-size select {
  width: 4.4rem;
  min-height: 2rem;
  border-radius: 999px;
  padding: 0 1.65rem 0 0.72rem;
  font-size: 0.82rem;
}

.table-page-size-suffix {
  white-space: nowrap;
}

.table-control-page-select {
  width: 96px;
}

.table-control-compact {
  width: min(18vw, 190px);
  min-width: 150px;
}

table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.62rem 0.68rem;
  text-align: left;
  vertical-align: middle;
  overflow: hidden;
}

.table-scroll-sticky th {
  box-sizing: border-box;
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 4;
}

thead tr:first-child th {
  height: var(--workspace-sticky-header-height);
  min-height: var(--workspace-sticky-header-height);
  border-bottom: 0;
  padding-bottom: 0.28rem;
  line-height: 1.05;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(13, 170, 145, 0.06);
}

tbody tr.manual-add-row:hover {
  background: transparent;
}

.match-unavailable {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

td input,
td select,
td textarea {
  min-height: 2rem;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  font-size: 0.88rem;
}

td textarea {
  min-height: 3.3rem;
  line-height: 1.25;
  resize: vertical;
}

.table-sort {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.column-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  margin-right: 0.22rem;
}

.sort-arrow-button {
  min-height: 1rem;
  min-width: 1rem;
  vertical-align: middle;
}

.table-scroll-sticky .table-filter-row th {
  position: sticky;
  top: calc(var(--workspace-sticky-header-height) - var(--workspace-sticky-row-overlap));
  height: var(--workspace-sticky-filter-height);
  min-height: var(--workspace-sticky-filter-height);
  z-index: 5;
  padding-top: 0.02rem;
  background: #f8fafc;
}

.table-scroll-sticky .table-filter-row-collapsible th {
  overflow: hidden;
  transition:
    height 1s ease,
    min-height 1s ease,
    max-height 1s ease,
    padding-top 1s ease,
    padding-bottom 1s ease,
    border-bottom-color 1s ease,
    opacity 1s ease;
}

.table-scroll-sticky .table-filter-row-collapsible.is-collapsing th {
  height: 0;
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
  line-height: 0;
  opacity: 0;
  pointer-events: none;
}

.table-scroll-sticky .table-filter-row-collapsible.is-collapsing .header-filter-control {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.table-scroll-sticky .row-selection-header {
  z-index: 12;
}

.table-scroll-sticky .row-selection-stack {
  z-index: 13;
}

.table-scroll-sticky .bulk-delete-header-button {
  z-index: 14;
}

.table-filter-cell {
  overflow: visible;
}

.table-filter-row .table-filter-cell:first-child {
  pointer-events: none;
}

.table-header-filter-form {
  display: none;
}

.header-filter-control {
  display: block;
  width: 100%;
  min-width: 0;
  max-height: 3rem;
  transition:
    max-height 1s ease,
    opacity 1s ease;
}

.header-filter-control span:not(.sr-only) {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.header-filter-control select,
.header-filter-control input {
  width: 100%;
  height: 1.95rem;
  min-height: 1.95rem;
  border-radius: 999px;
  padding: 0 0.72rem;
  font-size: 0.76rem;
  line-height: 1.95rem;
}

.header-filter-date {
  position: relative;
}

.header-filter-date-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.38rem;
  min-width: 6.9rem;
}

.header-date-filter-button {
  display: inline-flex;
  align-items: center;
  width: 100%;
  height: 1.95rem;
  min-height: 1.95rem;
  border-radius: 0.52rem;
  padding: 0 0.46rem;
  justify-content: center;
  text-align: center;
  font-size: 0.76rem;
  line-height: 1.95rem;
  white-space: nowrap;
}

.header-date-picker-input {
  position: absolute;
  right: 0.4rem;
  bottom: 0.2rem;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.actions-column {
  width: 1%;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.editable-cell {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 0.12rem;
}

.date-text-picker,
.editable-cell-date {
  position: relative;
}

.date-picker-proxy {
  position: absolute;
  right: 0.4rem;
  bottom: 0.2rem;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.editable-cell-textarea {
  align-items: stretch;
}

.editable-cell-match {
  align-items: start;
  min-width: 0;
}

.editable-cell-match.is-editing .match-readout {
  display: none;
}

.match-readout {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
  line-height: 1.25;
  max-height: 7rem;
  overflow: hidden;
  white-space: normal;
  transition: max-height 0.18s ease;
}

.match-readout strong,
.match-readout span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.match-readout strong {
  font-size: 0.86rem;
}

.match-readout span {
  color: var(--muted);
  font-size: 0.78rem;
}

.match-chip-list {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.match-chip {
  position: relative;
  display: block;
  min-width: 0;
  padding: 0.32rem 1.35rem 0.32rem 0.48rem;
  border: 1px solid rgba(13, 170, 145, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.match-chip.is-collapsed {
  border-radius: 12px;
}

.match-chip.is-collapsed .match-readout {
  max-height: 2.34rem;
}

.match-chip-remove-form {
  margin: 0;
}

.match-chip-remove {
  position: absolute;
  top: 0.34rem;
  right: 0.22rem;
  cursor: pointer;
}

.match-chip:hover .match-chip-remove,
.match-chip:focus-within .match-chip-remove {
  opacity: 1;
  pointer-events: auto;
}

.match-chip-remove:hover,
.match-chip-remove:focus-visible {
  color: var(--danger);
}

.editable-cell input[readonly],
.editable-cell textarea[readonly],
.editable-cell select:disabled {
  color: var(--ink);
  border-color: rgba(100, 116, 139, 0.22);
  background: transparent;
  box-shadow: none;
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
}

.editable-cell select:disabled {
  appearance: none;
  pointer-events: none;
}

.editable-cell:not(.is-editing) input[readonly],
.editable-cell:not(.is-editing) textarea[readonly],
.editable-cell:not(.is-editing) select:disabled,
.editable-cell-match:not(.is-editing) .match-readout {
  cursor: text;
}

.editable-cell:not(.is-editing):hover input[readonly],
.editable-cell:not(.is-editing):focus-within input[readonly],
.editable-cell:not(.is-editing):hover textarea[readonly],
.editable-cell:not(.is-editing):focus-within textarea[readonly],
.editable-cell:not(.is-editing):hover select:disabled,
.editable-cell:not(.is-editing):focus-within select:disabled,
.editable-cell-match:not(.is-editing):hover .match-readout,
.editable-cell-match:not(.is-editing):focus-within .match-readout {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(13, 170, 145, 0.34);
}

.match-picker {
  position: relative;
  display: block;
  min-width: 12rem;
}

.match-picker-toggle {
  --icon-action-size: 1.74rem;
  --icon-action-stroke-length: 0.72rem;
  --icon-action-stroke-width: 0.14rem;
  cursor: pointer;
}

.match-picker-toggle:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: transparent;
}

.match-picker-hover-only .match-picker-toggle {
  opacity: 0;
  pointer-events: none;
}

tr:hover .match-picker-hover-only .match-picker-toggle,
tr:focus-within .match-picker-hover-only .match-picker-toggle {
  opacity: 1;
  pointer-events: auto;
}

.match-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: #f8fafc;
}

.match-picker-backdrop[hidden] {
  display: none;
}

.match-picker-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0.65rem;
  width: min(1120px, calc(100vw - 3rem));
  max-height: min(78vh, 760px);
  padding: 0.72rem;
  border: 1px solid rgba(13, 170, 145, 0.22);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.match-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.match-picker-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  width: max-content;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.match-picker-checkbox input {
  min-height: 0;
}

.match-picker-search {
  flex: 1 1 16rem;
  min-width: 10rem;
  min-height: 2.15rem;
  padding: 0.38rem 0.62rem;
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 999px;
  font-size: 0.86rem;
}

.match-picker-upload-form {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
  white-space: nowrap;
}

.match-picker-upload-separator {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.match-picker-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.15rem;
  padding: 0.38rem 0.88rem;
  border: 1px solid rgba(13, 170, 145, 0.36);
  border-radius: 999px;
  background: rgba(13, 170, 145, 0.08);
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 900;
}

.match-picker-upload-button:hover {
  border-color: rgba(13, 170, 145, 0.6);
  background: rgba(13, 170, 145, 0.13);
}

.match-picker-upload-button[aria-disabled="true"] {
  cursor: wait;
  color: var(--muted);
  border-color: rgba(100, 116, 139, 0.24);
  background: rgba(100, 116, 139, 0.08);
}

.match-picker[data-upload-processing="true"] .match-picker-panel {
  opacity: 0.62;
  cursor: wait;
}

.match-picker[data-upload-processing="true"] .match-picker-toolbar,
.match-picker[data-upload-processing="true"] .match-picker-scroll,
.match-picker[data-upload-processing="true"] .match-picker-empty {
  filter: grayscale(0.18);
}

.match-picker[data-upload-processing="true"] .match-picker-row,
.match-picker[data-upload-processing="true"] .match-picker-sort,
.match-picker[data-upload-processing="true"] .match-picker-checkbox,
.match-picker[data-upload-processing="true"] .match-picker-search,
.match-picker[data-upload-processing="true"] .match-picker-upload-button {
  cursor: wait;
}

.match-picker[data-upload-processing="true"] .match-picker-row {
  pointer-events: none;
}

.match-picker-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.match-picker-scroll {
  min-height: 12rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.match-picker-table {
  display: grid;
  width: 100%;
  min-width: 760px;
}

.match-picker-head,
.match-picker-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(8rem, 1fr) minmax(6rem, 0.75fr) minmax(18rem, 2fr) 7rem auto;
  column-gap: 0.45rem;
}

.match-picker[data-match-kind="transaction"] .match-picker-head,
.match-picker[data-match-kind="transaction"] .match-picker-row {
  grid-template-columns: 6.5rem minmax(8rem, 1fr) minmax(22rem, 2.4fr) 7rem auto;
}

.match-picker-th,
.match-picker-td {
  min-width: 0;
  padding: 0.46rem 0.58rem;
  border-bottom: 1px solid rgba(100, 116, 139, 0.1);
  overflow: hidden;
}

.match-picker-td .compact-cell {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-picker-td .compact-cell-description {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.match-picker-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.match-picker-body {
  display: grid;
}

.match-picker-sort {
  min-height: 1.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.match-picker-row {
  width: 100%;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.match-picker-row[hidden] {
  display: none;
}

.match-picker-row:hover {
  background: rgba(240, 253, 249, 0.94);
}

.match-picker-row.match-candidate-strong {
  background: rgba(30, 179, 141, 0.12);
}

.match-picker-row.match-candidate-possible {
  background: rgba(215, 162, 53, 0.12);
}

.match-candidate-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.42);
}

.match-candidate-strong .match-candidate-dot {
  background: var(--teal);
}

.match-candidate-possible .match-candidate-dot {
  background: #d7a235;
}

.match-picker-already,
.match-picker-empty {
  color: var(--muted);
  font-size: 0.75rem;
}

.match-picker-already {
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.1);
  white-space: nowrap;
}

.match-picker-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 1%;
  white-space: nowrap;
}

.match-picker-empty {
  padding: 0.42rem 0.55rem;
}

input[type="checkbox"].row-select,
input[type="checkbox"][data-select-all="true"],
.request-items-table input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  margin: 0;
  accent-color: var(--teal);
}
