.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(800px, 90vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.headerInfo {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.body {
  overflow-y: auto;
  flex: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
  font-size: 13px;
  vertical-align: middle;
}

.table th:last-child,
.table td:last-child {
  text-align: right;
}

.matchedRow {
  background: rgba(var(--success-rgb, 68, 170, 136), 0.06);
}

.priorityCell {
  color: var(--text-muted);
  font-size: 12px;
  width: 30px;
}

.claimCode {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
}

.pillMatch {
  background: var(--bg-hover);
  color: var(--text-secondary, var(--text-muted));
}

.pillAssignRole {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.pillAddToGroup {
  background: color-mix(in srgb, var(--amber) 15%, transparent);
  color: var(--amber);
}

.matchValue {
  font-family: var(--font-mono);
  font-size: 12px;
}

.targetCell {
  font-weight: 500;
}

.actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
}

.iconBtn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.iconBtn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.iconBtn:disabled {
  opacity: 0.3;
  cursor: default;
}

.addRow {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.addRow input,
.addRow select {
  font-size: 12px;
}

.claimInput {
  width: 100px;
}

.matchSelect {
  width: 90px;
}

.valueInput {
  flex: 1;
}

.actionSelect {
  width: 120px;
}

.targetInput {
  width: 120px;
}

.emptyState {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.footerHint {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}

.footerActions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.testToggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  cursor: pointer;
  border-top: 2px solid var(--border);
  user-select: none;
}

.testToggle:hover {
  background: var(--bg-hover);
}

.testToggleLabel {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, var(--text-muted));
}

.testToggleHint {
  font-size: 12px;
  color: var(--text-muted);
}

.testPanel {
  display: flex;
  gap: 12px;
  padding: 0 20px 16px;
}

.testTextarea {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.testTextarea textarea {
  width: 100%;
  box-sizing: border-box;
  height: 140px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}

.testResults {
  flex: 1;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  min-height: 140px;
  box-sizing: border-box;
  overflow-y: auto;
}

.testResultsTitle {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.testMatch {
  margin-bottom: 10px;
}

.testMatchLabel {
  font-size: 12px;
  color: var(--success);
  margin-bottom: 4px;
}

.testMatchDetail {
  font-size: 12px;
  padding-left: 16px;
}

.testEffective {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.testEffectiveValues {
  color: var(--success);
  font-weight: 500;
}

.testFallback {
  font-size: 12px;
  color: var(--warning);
  font-style: italic;
}

.testError {
  font-size: 12px;
  color: var(--error);
}

.testEmpty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.matchCheck {
  color: var(--success);
}
