.linked-cell {
  text-align: center;
}

.linked-count,
.linked-unlink {
  border-color: #b8d8ca;
  color: #155e4b;
  background: #eef8f3;
}

.linked-count {
  min-width: 34px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 0.5rem;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: 400;
  line-height: 1.2;
}

.linked-unlink {
  min-height: 30px;
  padding: 0 0.65rem;
  font-size: 0.9rem;
}

.linked-count[aria-expanded="true"] {
  border-color: #1f6f5b;
  background: #dff3ea;
}

.linked-subrow td {
  padding: 0;
  background: #fbfcfc;
}

.linked-panel {
  display: grid;
  gap: 12px;
  padding: 14px 20px 16px 128px;
}

.linked-panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
}

.linked-panel-head button {
  min-height: 36px;
}

.linked-list table {
  width: auto;
  min-width: min(760px, 100%);
  border-collapse: collapse;
  background: #ffffff;
}

.linked-list td {
  border-top: 1px solid #e4e7ec;
  padding: 8px 10px;
}

.linked-list p {
  margin: 0;
  color: #667085;
}

.linked-include {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #334155;
}

.linked-include input {
  width: auto;
  min-height: 0;
}

.account-link-modal[hidden] {
  display: none;
}

.account-link-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(31, 41, 51, 0.24);
}

.account-link-window {
  box-sizing: border-box;
  display: grid;
  gap: 16px;
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid #d8dde6;
  border-radius: 8px;
  padding: 22px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(31, 41, 51, 0.18);
}

.account-link-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.account-link-header h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.account-link-close {
  width: 28px;
  height: 28px;
  min-height: 0;
  border-color: #c8d1dc;
  border-radius: 999px;
  padding: 0;
  color: #667085;
  background: #f8faf9;
  font-size: 1rem;
  line-height: 1;
}

.account-link-close:hover,
.account-link-close:focus-visible {
  border-color: #98a2b3;
  color: #1f2933;
  background: #eef2f1;
}

.account-link-sticky {
  position: sticky;
  top: -22px;
  z-index: 2;
  display: grid;
  gap: 12px;
  margin: 0 -22px;
  padding: 0 22px 12px;
  background: #ffffff;
  box-shadow: 0 12px 18px rgba(255, 255, 255, 0.94);
}

.account-link-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.account-link-search-row button {
  min-height: var(--control-height);
}

.link-search-status {
  margin: 0;
  color: #667085;
}

.link-search-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.link-search-toolbar button {
  min-height: 34px;
}

.link-search-status.is-error {
  color: #b42318;
}

.link-search-results {
  display: grid;
  gap: 8px;
}

.link-search-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfc;
}

.link-search-result:has(input:checked) {
  border-color: #b8d8cc;
  background: #f6fbf8;
}

.link-search-select {
  display: grid;
  place-items: center;
}

.link-search-select input {
  width: 18px;
  min-height: 18px;
}

.link-search-result p {
  margin: 0;
}

.link-search-result small {
  color: #667085;
}

.link-search-result button {
  min-height: 34px;
}

@media (max-width: 760px) {
  .linked-panel {
    padding-left: 16px;
  }

  .linked-panel-head,
  .account-link-search-row,
  .link-search-toolbar,
  .link-search-result {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .link-search-toolbar {
    display: grid;
  }

  .linked-panel-head {
    display: grid;
  }
}
