$bg-panel:     #ffffff;
$bg-card:      #f1f5f9;
$border:       #e2e8f0;
$text-primary: #1e293b;
$text-muted:   #64748b;
$accent-blue:  #2563eb;
$accent-red:   #dc2626;

// position:relative anchors the expanded body (below) as a dropdown positioned
// against this card rather than the page, so opening it grows downward over the
// content beneath instead of stretching the title row's height and shoving the
// picklist/header-cards sitting beside it.
.ws-card {
  position: relative;
  border: 1px solid $border;
  border-radius: 8px;
  background: $bg-panel;
  margin-bottom: 12px;
}

.ws-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: $bg-card;
  color: $text-primary;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.ws-card__header-summary {
  font-size: 12px;
  font-weight: 500;
  color: $text-muted;
}

.ws-card__spacer {
  flex: 1;
}

.collapse-chevron {
  color: $text-muted;
  font-size: 20px;
}

.ws-card--collapsed .ws-card__header {
  background: $bg-panel;
}

// Floats below the header as a dropdown (position:absolute against .ws-card,
// which is position:relative) instead of expanding the header's own row height —
// keeps the title row a fixed, compact height regardless of scan/picklist state.
.ws-card__body {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  // "right:0" would fight min-width whenever the header itself is narrower than
  // 320px (it shrinks with the flex row) - max() picks whichever is bigger so the
  // dropdown never gets squeezed narrower than its content needs.
  width: max(100%, 320px);
  max-height: 70vh;
  overflow-y: auto;
  padding: 14px;
  background: $bg-panel;
  border: 1px solid $border;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.18);
}

.scan-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: $accent-blue;
}

.workstation-picklist {
  margin-top: 12px;

  label {
    display: block;
    font-size: 12px;
    color: $text-muted;
    margin-bottom: 4px;
  }
}

.ws-card__state {
  margin-top: 10px;
  font-size: 13px;
  color: $text-muted;

  &--error {
    color: $accent-red;
  }
}

.ws-resolved-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ws-code-badge {
  padding: 2px 8px;
  border-radius: 4px;
  background: $bg-card;
  font-weight: 600;
  font-size: 13px;
}

.ws-name {
  font-size: 13px;
  color: $text-primary;
}

.ws-arrow {
  color: $text-muted;
}

.ws-wi-badge {
  padding: 2px 10px;
  border-radius: 12px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
}

.clear-btn {
  margin-top: 12px;
  padding: 6px 12px;
  border: 1px solid $border;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.diag-toggle {
  margin-top: 10px;
  padding: 0;
  border: none;
  background: none;
  color: $accent-blue;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.ws-diagnostics {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid $border;
  border-radius: 4px;
  background: $bg-card;
  font-size: 12px;
  color: $text-primary;

  &__row {
    padding: 2px 0;

    &--muted {
      color: $text-muted;
    }
  }

  .is-wildcard {
    color: $text-muted;
  }

  .is-exact {
    color: $accent-blue;
    font-weight: 600;
  }
}
