.lookup-overlay {
  align-items: center;
  background: rgba(15, 23, 42, .28);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  user-select: none;
  z-index: 1400;
}

.lookup-overlay.is-open {
  display: flex;
}

.lookup-dialog {
  background: #fff;
  border: 1px solid #8799ad;
  box-shadow: 0 14px 34px rgba(18, 31, 48, .28);
  box-sizing: border-box;
  color: #10233e;
  display: grid;
  grid-template-rows: 38px 42px minmax(0, 1fr) 44px;
  height: min(560px, calc(100vh - 36px));
  max-width: 760px;
  padding: 12px;
  width: min(760px, calc(100vw - 36px));
}

.lookup-titlebar {
  align-items: center;
  background: #b8cbe0;
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
}

.lookup-titlebar h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.lookup-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  height: 30px;
  padding: 0;
  position: relative;
  width: 30px;
}

.lookup-close::before,
.lookup-close::after {
  background: #17395c;
  content: "";
  height: 2px;
  left: 7px;
  position: absolute;
  top: 14px;
  width: 16px;
}

.lookup-close::before {
  transform: rotate(45deg);
}

.lookup-close::after {
  transform: rotate(-45deg);
}

.lookup-toolbar {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: max-content minmax(0, 1fr);
  padding-top: 8px;
}

.lookup-toolbar label {
  align-items: center;
  background: #b8cbe0;
  border: 1px solid #8799ad;
  box-sizing: border-box;
  display: flex;
  font-size: 13px;
  height: 30px;
  padding: 0 10px;
}

.lookup-search {
  background: #fff;
  border: 1px solid #8799ad;
  border-radius: 4px;
  box-sizing: border-box;
  color: #10233e;
  font: inherit;
  height: 30px;
  min-width: 0;
  padding: 0 9px;
  user-select: text;
}

.lookup-search:focus {
  border-color: #4b64a5;
  box-shadow: 0 0 0 2px rgba(75, 100, 165, .16);
  outline: none;
}

.lookup-table-wrap {
  background: #fff;
  border: 1px solid #8799ad;
  min-height: 0;
  overflow: auto;
  outline: none;
}

.lookup-table {
  border-collapse: collapse;
  color: #10233e;
  font-size: 13px;
  table-layout: fixed;
  user-select: none;
  width: 100%;
}

.lookup-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.lookup-table th {
  background: #b8cbe0;
  border: 1px solid #c8d1dc;
  color: #17395c;
  font-size: 12px;
  font-weight: 500;
  height: 30px;
  padding: 0;
  text-align: left;
}

.lookup-table th button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 5px;
  height: 100%;
  padding: 0 8px;
  text-align: left;
  width: 100%;
}

.lookup-table th button::after {
  color: #4b64a5;
  content: "";
  font-size: 10px;
  min-width: 10px;
}

.lookup-table th button.is-active[data-direction="asc"]::after {
  content: "▲";
}

.lookup-table th button.is-active[data-direction="desc"]::after {
  content: "▼";
}

.lookup-table th:first-child,
.lookup-table td:first-child {
  text-align: center;
  width: 110px;
}

.lookup-table th:last-child,
.lookup-table td:last-child {
  width: 250px;
}

.lookup-table td {
  border: 1px solid #d4dce6;
  height: 29px;
  overflow: hidden;
  padding: 0 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lookup-table tbody tr:nth-child(even) {
  background: #f4f7fa;
}

.lookup-table tbody tr:hover td {
  background: #e3edf8;
}

.lookup-table tbody tr.selected td,
.lookup-table tbody tr.selected:hover td {
  background: #b8cbe0;
  color: #0b2f55;
}

.lookup-actions {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 10px;
}

.lookup-actions button {
  border: 1px solid #4b64a5;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  height: 34px;
  min-width: 112px;
}

.lookup-actions .lookup-select {
  background: #506fc8;
  color: #fff;
}

.lookup-actions .lookup-cancel {
  background: #fff;
  color: #173b65;
}

.lookup-actions button:hover,
.lookup-actions button:focus-visible {
  background: #244f8d;
  color: #fff;
  outline: none;
}

@media (max-width: 620px) {
  .lookup-dialog {
    grid-template-rows: 38px 42px minmax(0, 1fr) 44px;
    padding: 9px;
  }

  .lookup-table {
    min-width: 560px;
  }

  .lookup-table th:last-child,
  .lookup-table td:last-child {
    width: 190px;
  }
}
